Thread (3 messages) flat view 3 messages, 3 authors, 2016-06-15

Re: git-daemon problem

From: Andre Noll <hidden>
Date: 2016-06-15 22:42:33

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

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help