From 1442403a5da3f891b6f7f07b4f36a687c39e94c0 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 12 Aug 2005 08:25:52 +0000 Subject: (main): Explain why we reopen stdin for write-only access. --- src/nohup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nohup.c b/src/nohup.c index b8b8c76b0..bd3bc3bd7 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); -- cgit v1.2.3-54-g00ecf