From b7d6bb0833f30ae34775d3bb83e657ed7f1eefab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Thu, 10 Apr 2003 10:26:18 +0000 Subject: [PATCH] Brucify. --- lib/libutil/pw_util.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/libutil/pw_util.c b/lib/libutil/pw_util.c index 73d544b7a1d8..a5458786affc 100644 --- a/lib/libutil/pw_util.c +++ b/lib/libutil/pw_util.c @@ -62,6 +62,7 @@ static const char rcsid[] = #include #include #include +#include #include #include #include @@ -288,7 +289,7 @@ int pw_edit(int notsetuid) { struct sigaction sa, sa_int, sa_quit; - sigset_t sigset, oldsigset; + sigset_t oldsigset, sigset; struct stat st1, st2; const char *editor; int pstat; @@ -310,14 +311,14 @@ pw_edit(int notsetuid) return (-1); case 0: sigaction(SIGINT, &sa_int, NULL); - sigaction(SIGQUIT, &sa_quit, NULL); + sigaction(SIGQUIT, &sa_quit, NULL); sigprocmask(SIG_SETMASK, &oldsigset, NULL); if (notsetuid) { (void)setgid(getgid()); (void)setuid(getuid()); } errno = 0; - execlp(editor, editor, tempname, NULL); + execlp(editor, basename(editor), tempname, NULL); _exit(errno); default: /* parent */ @@ -325,7 +326,10 @@ pw_edit(int notsetuid) } for (;;) { if (waitpid(editpid, &pstat, WUNTRACED) == -1) { + if (errno == EINTR) + continue; unlink(tempname); + editpid = -1; break; } else if (WIFSTOPPED(pstat)) { raise(WSTOPSIG(pstat)); @@ -339,7 +343,7 @@ pw_edit(int notsetuid) } } sigaction(SIGINT, &sa_int, NULL); - sigaction(SIGQUIT, &sa_quit, NULL); + sigaction(SIGQUIT, &sa_quit, NULL); sigprocmask(SIG_SETMASK, &oldsigset, NULL); if (stat(tempname, &st2) == -1) return (-1);