nohup: if fd_repoen fails (redirecting stdin), report it

* src/nohup.c (main): Don't ignore fd_reopen failure.
This commit is contained in:
Jim Meyering committed 2009-12-13 12:23:41 +01:00
1 parent 6ee02e3d83
commit c149538652
1 file changed
+5 -1
+5 -1
View 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"));
}