diff options
author | des <des@FreeBSD.org> | 2003-04-10 10:26:18 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2003-04-10 10:26:18 +0000 |
commit | dcecf33e14272d81ccbef81f4b7722d434d2b057 (patch) | |
tree | 44f9c6c1f842a22c8a35eabbc6ddf6aa4374c31f /lib | |
parent | 5e99ad1e4e5e91b52b076d5bf6adaf499df5e976 (diff) | |
download | FreeBSD-src-dcecf33e14272d81ccbef81f4b7722d434d2b057.zip FreeBSD-src-dcecf33e14272d81ccbef81f4b7722d434d2b057.tar.gz |
Brucify.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libutil/pw_util.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/libutil/pw_util.c b/lib/libutil/pw_util.c index 73d544b..a545878 100644 --- a/lib/libutil/pw_util.c +++ b/lib/libutil/pw_util.c @@ -62,6 +62,7 @@ static const char rcsid[] = #include <ctype.h> #include <fcntl.h> #include <inttypes.h> +#include <libgen.h> #include <paths.h> #include <pwd.h> #include <signal.h> @@ -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); |