[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [lvm-devel] [PATCH] Remove the double open with same mode



On Mon, Mar 15, 2010 at 10:41:33AM -0700, malahal us ibm com wrote:
> Then how about this:
> diff -r 8db1b9ee17a8 daemons/dmeventd/dmeventd.c
> --- a/daemons/dmeventd/dmeventd.c	Fri Mar 12 16:15:25 2010 -0800
> +++ b/daemons/dmeventd/dmeventd.c	Mon Mar 15 10:38:49 2010 -0700
> @@ -1650,9 +1650,10 @@ static void _daemonize(void)
>  	for (--fd; fd >= 0; fd--)
>  		close(fd);
>  
> -	if ((open("/dev/null", O_RDONLY) < 0) ||
> -	    (open("/dev/null", O_WRONLY) < 0) ||
> -	    (open("/dev/null", O_WRONLY) < 0))
> +	/* open stdin, stdout, stderr */
> +	if ((open("/dev/null", O_RDONLY) != 0) ||
> +	    (open("/dev/null", O_WRONLY) != 1) ||
> +	    (open("/dev/null", O_WRONLY) != 2))
>  		exit(EXIT_DESC_OPEN_FAILURE);
 
Nack.  Complete waste of time.

Alasdair.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]