summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2009-12-13 12:23:25 +0100
committerJim Meyering <meyering@redhat.com>2009-12-13 12:23:41 +0100
commitc149538652964625541f45dc4ed0be9da1dcb30f (patch)
tree58a3fc9bed9061a5ebe102c37ba2189ab82bd2d1
parent6ee02e3d8301eb7fb58b374c72b41c52836a104d (diff)
downloadcoreutils-c149538652964625541f45dc4ed0be9da1dcb30f.tar.xz
nohup: if fd_repoen fails (redirecting stdin), report it
* src/nohup.c (main): Don't ignore fd_reopen failure.
-rw-r--r--src/nohup.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/nohup.c b/src/nohup.c
index 1f92c3f5a..ea0b56ef9 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"));
}