From c149538652964625541f45dc4ed0be9da1dcb30f Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 13 Dec 2009 12:23:25 +0100 Subject: [PATCH] nohup: if fd_repoen fails (redirecting stdin), report it * src/nohup.c (main): Don't ignore fd_reopen failure. --- src/nohup.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/nohup.c b/src/nohup.c index 1f92c3f5a8..ea0b56ef9c 100644 --- a/src/nohup.c +++ b/src/nohup.c @@ -123,7 +123,11 @@ main (int argc, char **argv) to ensure any read evokes an error. */ if (ignoring_input) { - fd_reopen (STDIN_FILENO, "/dev/null", O_WRONLY, 0); + if (fd_reopen (STDIN_FILENO, "/dev/null", O_WRONLY, 0) < 0) + { + error (0, errno, _("failed to render standard input unusable")); + exit (exit_internal_failure); + } if (!redirecting_stdout && !redirecting_stderr) error (0, 0, _("ignoring input")); } -- 2.47.3