diff options
author | Richard Jones <rjones@debian5x64.home.annexia.org> | 2009-11-04 15:47:03 +0000 |
---|---|---|
committer | Richard Jones <rjones@debian5x64.home.annexia.org> | 2009-11-04 15:47:03 +0000 |
commit | df1af0bbe21e906c11123e66ec470b60e55c9e44 (patch) | |
tree | ed4bb384aec2f391f9678a0ec590207956b6d5bb | |
parent | a3be3a3b877277c1e4b130e1676b9ad307cafa10 (diff) | |
download | libguestfs-df1af0bbe21e906c11123e66ec470b60e55c9e44.tar.gz libguestfs-df1af0bbe21e906c11123e66ec470b60e55c9e44.tar.xz libguestfs-df1af0bbe21e906c11123e66ec470b60e55c9e44.zip |
daemon: When running external commands, open stdin as /dev/null
Previously when we ran external commands from the daemon, stdin
(ie. fd 0) was closed. This caused a problem when running the
external hexdump command which seems to break if stdin is closed.
This patch opens stdin on /dev/null.
-rw-r--r-- | daemon/guestfsd.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c index 8c39c39c..649a630c 100644 --- a/daemon/guestfsd.c +++ b/daemon/guestfsd.c @@ -654,6 +654,7 @@ commandrv (char **stdoutput, char **stderror, char const* const *argv) if (pid == 0) { /* Child process. */ close (0); + open ("/dev/null", O_RDONLY); /* Set stdin to /dev/null (ignore failure) */ close (so_fd[0]); close (se_fd[0]); dup2 (so_fd[1], 1); |