ia64/xen-unstable

changeset 15850:05950e909ba6

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>
author kfraser@localhost.localdomain
date Fri Sep 07 10:26:33 2007 +0100 (2007-09-07)
parents f779ee15c553
children f2bc66154ba9
files tools/xenstore/xenstored_core.c
line diff
     1.1 --- a/tools/xenstore/xenstored_core.c	Fri Sep 07 10:18:54 2007 +0100
     1.2 +++ b/tools/xenstore/xenstored_core.c	Fri Sep 07 10:26:33 2007 +0100
     1.3 @@ -1878,14 +1878,14 @@ int main(int argc, char *argv[])
     1.4  		fflush(stdout);
     1.5  	}
     1.6  
     1.7 -	/* close stdin/stdout now we're ready to accept connections */
     1.8 +	/* redirect to /dev/null now we're ready to accept connections */
     1.9  	if (dofork) {
    1.10  		int devnull = open("/dev/null", O_RDWR);
    1.11  		if (devnull == -1)
    1.12  			barf_perror("Could not open /dev/null\n");
    1.13 -		close(STDIN_FILENO);  dup2(STDIN_FILENO, devnull);
    1.14 -		close(STDOUT_FILENO); dup2(STDOUT_FILENO, devnull);
    1.15 -		close(STDERR_FILENO); dup2(STDERR_FILENO, devnull);
    1.16 +		dup2(devnull, STDIN_FILENO);
    1.17 +		dup2(devnull, STDOUT_FILENO);
    1.18 +		dup2(devnull, STDERR_FILENO);
    1.19  		close(devnull);
    1.20  		xprintf = trace;
    1.21  	}