Re: [PATCH 5/5] daemon: new option --detach to run git-daemon in background

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

 



Matthias Lederhofer wrote:
>
> [daemonize]
> +	if ((devnull = open("/dev/null", O_RDWR, 0)) == -1)
> +		die("open /dev/null failed: %s", strerror(errno));
> +	if (dup2(devnull, 0) != 0 ||
> +		dup2(devnull, 1) != 1 ||
> +		dup2(devnull, 2) != 2)
> +		die("dup2 failed: %s", strerror(errno));
> +}

Hmm... leaks devnull.  Why not simply close(0/1/2) and
let sanitize_stdfds take care of the rest?

Ciao, ET.
-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]