Anyone have a problem w/ closing fd's in daemonize

Russ Allbery rra at stanford.edu
Fri Aug 23 15:24:57 UTC 2002


Alex Kiernan <alexk at demon.net> writes:

> I've been running with this for a while, its just adding stuff which
> daemon() has done for ages (ever?).

> Anyone see any issues? It fixes the "hang on logout" issue which you
> otherwise see with current OpenSSH on (at least) Solaris.

No problems here.

> +    if ((fd = open("/dev/null", O_RDWR, 0)) != -1) {

Better to separate this into:

    fd = open("/dev/null", O_RDWR, 0);
    if (fd != -1) {

It's a bit easier to read.  (I should add something about this to the
style section of HACKING, since lots of existing INN code doesn't do
this.)

-- 
Russ Allbery (rra at stanford.edu)             <http://www.eyrie.org/~eagle/>

    Please send questions to the list rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.


More information about the inn-workers mailing list