child = fork();
switch (child) {
case -1:
- error(1, "fork");
+ error(1, _("unable to fork"));
break;
case 0:
/* child */
cstat->val = errno;
return -1;
case 0:
- /* child continues */
+ /* child continues without controlling terminal */
+ (void)setpgid(0, 0);
break;
default:
- /* parent exits */
- exit(0);
+ /* parent exits (but does not flush buffers) */
+ _exit(0);
}
}
/*
* If we have an I/O plugin or the policy plugin has requested one, we
* need to allocate a pty. It is OK to set log_io in the pty-only case
- * as the tailqueue plugin will be empty and no I/O logging will occur.
+ * as the io plugin tailqueue will be empty and no I/O logging will occur.
*/
if (!tq_empty(&io_plugins) || ISSET(details->flags, CD_USE_PTY)) {
log_io = TRUE;
- if (!ISSET(details->flags, CD_BACKGROUND)) {
- if (ISSET(details->flags, CD_SET_UTMP))
- utmp_user = details->utmp_user ? details->utmp_user : user_details.username;
- sudo_debug(8, "allocate pty for I/O logging");
- pty_setup(details->euid, user_details.tty, utmp_user);
- }
+ if (ISSET(details->flags, CD_SET_UTMP))
+ utmp_user = details->utmp_user ? details->utmp_user : user_details.username;
+ sudo_debug(8, "allocate pty for I/O logging");
+ pty_setup(details->euid, user_details.tty, utmp_user);
}
/*
* Parent sends signal info to child and child sends back wait status.
*/
if (socketpair(PF_UNIX, SOCK_DGRAM, 0, sv) == -1)
- error(1, "cannot create sockets");
+ error(1, _("unable to create sockets"));
/*
* We use a pipe to atomically handle signal notification within
* the select() loop.
*/
if (pipe_nonblock(signal_pipe) != 0)
- error(1, "cannot create pipe");
+ error(1, _("unable to create pipe"));
zero_bytes(&sa, sizeof(sa));
sigemptyset(&sa.sa_mask);
if (nready == -1) {
if (errno == EINTR)
continue;
- error(1, "select failed");
+ error(1, _("select failed"));
}
if (FD_ISSET(sv[0], fdsw)) {
forward_signals(sv[0]);
if (ISSET(details->flags, CD_RBAC_ENABLED)) {
/* This is probably not needed in log_io mode. */
if (selinux_restore_tty() != 0)
- warningx("unable to restore tty label");
+ warningx(_("unable to restore tty label"));
}
#endif