tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Library support for two-phase daemonization



A couple of days ago, Iain Hibbert wrote:
> btw I did this in btpand(8), which uses libevent (and thus kqueue)

That's good, but I think it has a race condition: the SIGUSR1 can be
delivered to the parent before it has called signal(SIGUSR1, main_exit).

> one minor nit from me is that syscalls such as pipe(2), fork(2) and
> read(2) return "-1" for error according to the manpages .. using a test
> for "< 0" to detect that never seems right to me,

Testing for < 0 is a long-standing tradition which I will honor
as long as /usr/share/misc/style does. :)

> especially when casting from a different type which could involve a
> truncation (eg ssize_t)

Checking a truncated value is wrong whether you check for < 0 or == -1.
I will fix the truncation.
-- 
Andreas Gustafsson, gson%NetBSD.org@localhost


Home | Main Index | Thread Index | Old Index