Don't use log_error() in the child process.

This commit is contained in:
Todd C. Miller
2009-10-22 13:40:41 +00:00
parent 425026fa11
commit b231f074a2

View File

@@ -583,8 +583,10 @@ script_child(path, argv, rbac_enabled)
* This allows us to be notified when the child has been suspended. * This allows us to be notified when the child has been suspended.
*/ */
#ifdef HAVE_SETSID #ifdef HAVE_SETSID
if (setsid() == -1) if (setsid() == -1) {
log_error(USE_ERRNO, "setsid"); warning("setsid");
_exit(1);
}
#else #else
# ifdef TIOCNOTTY # ifdef TIOCNOTTY
n = open(_PATH_TTY, O_RDWR|O_NOCTTY); n = open(_PATH_TTY, O_RDWR|O_NOCTTY);
@@ -608,8 +610,10 @@ script_child(path, argv, rbac_enabled)
/* Start command and wait for it to stop or exit */ /* Start command and wait for it to stop or exit */
child = fork(); child = fork();
if (child == -1) if (child == -1) {
log_error(USE_ERRNO, "Can't fork"); warning("Can't fork");
_exit(1);
}
if (child == 0) { if (child == 0) {
/* setup tty and exec command */ /* setup tty and exec command */
script_run(path, argv, rbac_enabled); script_run(path, argv, rbac_enabled);