sigaction(SIGQUIT, &sa_quit, NULL);
sigprocmask(SIG_SETMASK, &oldsigset, NULL);
if (notsetuid) {
- (void)setgid(getgid());
- (void)setuid(getuid());
+ if (setgid(getgid()) == -1)
+ err(1, "setgid");
+ if (setuid(getuid()) == -1)
+ err(1, "setuid");
}
- errno = 0;
execlp(editor, editor, tempname, (char *)NULL);
- _exit(errno);
+ err(1, "%s", editor);
default:
/* parent */
break;
break;
} else if (WIFSTOPPED(pstat)) {
raise(WSTOPSIG(pstat));
- } else if (WIFEXITED(pstat) && WEXITSTATUS(pstat) == 0) {
+ } else if (WIFEXITED(pstat)) {
+ if (WEXITSTATUS(pstat) != 0)
+ errx(1, "\"%s\" exited with status %d", editor, WEXITSTATUS(pstat));
editpid = -1;
break;
} else {