From: Jim Meyering Date: Fri, 12 Aug 2005 08:25:52 +0000 (+0000) Subject: (main): Explain why we reopen stdin for write-only access. X-Git-Tag: CPPI-1_12~188 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1442403a5da3f891b6f7f07b4f36a687c39e94c0;p=thirdparty%2Fcoreutils.git (main): Explain why we reopen stdin for write-only access. --- diff --git a/src/nohup.c b/src/nohup.c index b8b8c76b08..bd3bc3bd70 100644 --- a/src/nohup.c +++ b/src/nohup.c @@ -97,7 +97,9 @@ main (int argc, char **argv) usage (NOHUP_FAILURE); } - /* If standard input is a tty, replace it with /dev/null. */ + /* If standard input is a tty, replace it with /dev/null. + Note that it is deliberately opened for *writing*, + to ensure any read evokes an error. */ if (isatty (STDIN_FILENO)) fd_reopen (STDIN_FILENO, "/dev/null", O_WRONLY, 0);