X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=daemon%2Fguestfsd.c;h=c0d524aa2897c2b9cce55d87541294b5b789923d;hp=cd51f442486c1537c37618abed1fdf6495926ea0;hb=7cb6fac3074c52ac3c3e9ead5d99e4a2887cf7b1;hpb=07369cb77a07f965cbf8e02f485c78a22c091f85 diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c index cd51f44..c0d524a 100644 --- a/daemon/guestfsd.c +++ b/daemon/guestfsd.c @@ -41,6 +41,7 @@ #include #include #include +#include #ifdef HAVE_PRINTF_H # include @@ -758,20 +759,20 @@ commandrvf (char **stdoutput, char **stderror, int flags, */ if (pipe (so_fd) == -1 || pipe (se_fd) == -1) { - perror ("pipe"); + error (0, errno, "pipe"); abort (); } if (flag_copy_stdin) { if (pipe (stdin_fd) == -1) { - perror ("pipe"); + error (0, errno, "pipe"); abort (); } } pid = fork (); if (pid == -1) { - perror ("fork"); + error (0, errno, "fork"); abort (); } @@ -781,9 +782,10 @@ commandrvf (char **stdoutput, char **stderror, int flags, dup2 (stdin_fd[0], 0); close (stdin_fd[0]); close (stdin_fd[1]); - } else + } else { /* Set stdin to /dev/null (ignore failure) */ open ("/dev/null", O_RDONLY); + } close (so_fd[0]); close (se_fd[0]); if (!(flags & COMMAND_FLAG_FOLD_STDOUT_ON_STDERR)) @@ -804,7 +806,7 @@ commandrvf (char **stdoutput, char **stderror, int flags, stdin_pid = fork (); if (stdin_pid == -1) { - perror ("fork"); + error (0, errno, "fork"); abort (); }