Re: git-daemon problem

From: Andre Noll <maan@systemlinux.org>
Date: 2006-07-13 21:42:21
On 22:44, Junio C Hamano wrote:

> The only "right" solution I could think of is to properly
> daemonize git-daemon when not running under --inetd mode.  Close
> and open /dev/null the low three fds, and dissociate the process
> from the controlling terminal (did I forget anything else --
> perhaps chdir("/") at the top?).  And we keep the current
> behaviour of assuming the sane set of low three fds when a new
> option --debug is given to help people look at its stderr.  The
> tentative patch to upload-pack would become moot at that point.
> 
> Hmm?

A common solution for this problem is 

	while (1) {
		int     fd;

		fd = open("/dev/null", O_RDWR);
		if (fd < 0)
			exit(EX_OSERR);
		if (fd > 2) {
			close(fd);
			break;
		}
	}

See

	http://rechner.lst.de/~okir/blackhats/node41.html

Andre
-- 
The only person who always got his work done by Friday was Robinson Crusoe

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Received on Thu Jul 13 21:44:14 2006

This archive was generated by hypermail 2.1.8 : 2006-07-13 21:44:40 EST