[git commit master] do not pass 3rd param to open() which do not create files

Mike Frysinger vapier at gentoo.org
Sat Sep 5 21:33:47 UTC 2009


On Saturday 05 September 2009 17:35:09 Denys Vlasenko wrote:
> ---
>  libc/unistd/daemon.c |   16 ++++------------
>  utils/ldd.c          |    2 +-
>  2 files changed, 5 insertions(+), 13 deletions(-)
>
> diff --git a/libc/unistd/daemon.c b/libc/unistd/daemon.c
> index b18d618..3dcd995 100644
> --- a/libc/unistd/daemon.c
> +++ b/libc/unistd/daemon.c
> @@ -49,14 +49,6 @@
>
>  #if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_UNIX98)
>
> -/* libc_hidden_proto(open) */
> -/* libc_hidden_proto(close) */
> -/* libc_hidden_proto(_exit) */
> -/* libc_hidden_proto(dup2) */
> -/* libc_hidden_proto(setsid) */
> -/* libc_hidden_proto(chdir) */
> -/* libc_hidden_proto(fork) */
> -
>  #ifndef __ARCH_USE_MMU__
>  #include <sys/syscall.h>
>  #include <sched.h>
> @@ -93,7 +85,7 @@ static inline pid_t fork_parent(void)
>  }
>  #endif
>
> -int daemon( int nochdir, int noclose )
> +int daemon(int nochdir, int noclose)
>  {
>  	int fd;
>
> @@ -101,18 +93,18 @@ int daemon( int nochdir, int noclose )
>  		return -1;
>
>  	if (setsid() == -1)
> -		return(-1);
> +		return -1;
>
>  	if (!nochdir)
>  		chdir("/");
>
> -	if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
> +	if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR)) != -1) {
>  		dup2(fd, STDIN_FILENO);
>  		dup2(fd, STDOUT_FILENO);
>  		dup2(fd, STDERR_FILENO);
>  		if (fd > 2)
>  			close(fd);
>  	}
> -	return(0);
> +	return 0;
>  }
>  #endif

again, unrelated style changes.  please review what you're committing.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.busybox.net/pipermail/uclibc/attachments/20090905/b8b44e51/attachment.pgp>


More information about the uClibc mailing list