Re: [PATCH 5/5] daemon: new option --detach to run git-daemon in background
- From
- Edgar Toernig <froese@gmx.de>
- Date
- Jul 13, 2006, 13:37 UTC
- Message-ID
- <20060713153703.05f862ee.froese@gmx.de>
- In-Reply-To
- <E1G0znB-0002If-8A@moooo.ath.cx>
Matthias Lederhofer wrote:
Show 9 quoted lines
>
> [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.