aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-09-07 10:26:33 +0100
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-09-07 10:26:33 +0100
commit038aa6bdc09e895a5a09e52e3710572a27978dd8 (patch)
treec538cb739c34971507195c0c806b4a402297bec8
parent05bc962b373f5f41c5659d0287e3cf0d2973cc89 (diff)
downloadxen-038aa6bdc09e895a5a09e52e3710572a27978dd8.tar.gz
xen-038aa6bdc09e895a5a09e52e3710572a27978dd8.tar.bz2
xen-038aa6bdc09e895a5a09e52e3710572a27978dd8.zip
Fix xenstored's dup2() usage.
The dup2() calls had their arguments reversed. Also remove the unnecessary close() calls. Signed-off-by: John Levon <john.levon@sun.com>
-rw-r--r--tools/xenstore/xenstored_core.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index e68004ad05..1b9b32d67d 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -1878,14 +1878,14 @@ int main(int argc, char *argv[])
fflush(stdout);
}
- /* close stdin/stdout now we're ready to accept connections */
+ /* redirect to /dev/null now we're ready to accept connections */
if (dofork) {
int devnull = open("/dev/null", O_RDWR);
if (devnull == -1)
barf_perror("Could not open /dev/null\n");
- close(STDIN_FILENO); dup2(STDIN_FILENO, devnull);
- close(STDOUT_FILENO); dup2(STDOUT_FILENO, devnull);
- close(STDERR_FILENO); dup2(STDERR_FILENO, devnull);
+ dup2(devnull, STDIN_FILENO);
+ dup2(devnull, STDOUT_FILENO);
+ dup2(devnull, STDERR_FILENO);
close(devnull);
xprintf = trace;
}