- } else dup2(nullfd, STDOUT_FILENO);
-
- /* If we have a tty on strderr, announce filename and redirect to stdout.
- * Else redirect to /dev/null.
- */
- temp = isatty(STDERR_FILENO);
- if (temp) bb_error_msg("appending to %s", nohupout);
- dup2(temp ? STDOUT_FILENO : nullfd, STDERR_FILENO);
- close(nullfd);
- signal (SIGHUP, SIG_IGN);
-
- execvp(argv[1],argv+1);
- if (00 && ENABLE_FEATURE_CLEAN_UP && home) free(nohupout);
- bb_perror_msg_and_die("%s", argv[1]);
+ bb_error_msg("appending output to %s", nohupout);
+ }
+
+ /* If we have a tty on stderr, redirect to stdout. */
+ if (isatty(STDERR_FILENO)) {
+ /* if (stdout_wasnt_a_tty)
+ bb_error_msg("redirecting stderr to stdout"); */
+ dup2(STDOUT_FILENO, STDERR_FILENO);
+ }
+
+ signal(SIGHUP, SIG_IGN);
+
+ BB_EXECVP(argv[1], argv+1);
+ bb_simple_perror_msg_and_die(argv[1]);