Re: Problem with zeroconf daemonization

Lennart Poettering <[email protected]>
Newsgroups gmane.comp.compilers.distcc
Organization Red Hat, Inc.
Message-ID <[email protected]>
On Mon, 18.01.10 01:10, Benjamin R. Haskell ([email protected]) wrote:

> If so, it seems like a pretty easy fix (to just close more fd's than 0, 
> 1, and 2).  I can commit the attached patch if 1024 doesn't seem too 
> magic-number-y (and I'm not spouting nonsense).

Uh, hardcoding the 1024 is not a good idea. And always looping up to
RLIMIT_NOFILE or _SC_OPEN_MAX is actually kinda slow. Looping through
/proc/self/fd/ should be the fastest way to close all those fds.

Might be an idea to simply copy this function:

http://git.0pointer.de/?p=libdaemon.git;a=blob;f=libdaemon/dfork.c;h=70fce862894ba16d66127d10547799aaa045fad4;hb=refs/heads/master#l485

Lennart

-- 
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/           GnuPG 0x1A015CC4
__
distcc mailing list            http://distcc.samba.org/
To unsubscribe or change options:
https://lists.samba.org/mailman/listinfo/distcc
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.