]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
nohup: if fd_repoen fails (redirecting stdin), report it
authorJim Meyering <meyering@redhat.com>
Sun, 13 Dec 2009 11:23:25 +0000 (12:23 +0100)
committerJim Meyering <meyering@redhat.com>
Sun, 13 Dec 2009 11:23:41 +0000 (12:23 +0100)
* src/nohup.c (main): Don't ignore fd_reopen failure.

src/nohup.c

index 1f92c3f5a8e8d2408110252e6825ac3d479b6507..ea0b56ef9c2c7a5a46d36b11406cd30e05ed3b41 100644 (file)
@@ -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"));
     }