git.annexia.org
/
libguestfs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a3be3a3
)
daemon: When running external commands, open stdin as /dev/null
author
Richard Jones
<rjones@debian5x64.home.annexia.org>
Wed, 4 Nov 2009 15:47:03 +0000
(15:47 +0000)
committer
Richard Jones
<rjones@debian5x64.home.annexia.org>
Wed, 4 Nov 2009 15:47:03 +0000
(15:47 +0000)
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.
daemon/guestfsd.c
patch
|
blob
|
history
diff --git
a/daemon/guestfsd.c
b/daemon/guestfsd.c
index
8c39c39
..
649a630
100644
(file)
--- 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);