[OPEN-ILS-DEV] PATCH: osrfConfig.C (dropping stderr messages)
Scott McKellar
mck9 at swbell.net
Fri Jun 29 00:52:45 EDT 2007
--- Mike Rylander <mrylander at gmail.com> wrote:
>> [snip]
>
> That is a solid plan. If you're raising your hand then I'd love to
> see the patch. I'd also like to get Bill's input, since this is his
> code we're beating about, but daemonization needs to be fixed up.
> */me
> pokes Bill*
Yeah, I guess I'm raising my hand. I'll try to put a patch together
tomorrow evening, unless somebody else gets there first.
Two caveats:
1. If I were a real systems programmer I wouldn't be digging simple
stuff out of books. Please examine closely whatever I send you.
2. I'm not in a position to readily test this kind of change. Since
I don't have a library to run, and don't need to set up a functional
system, my executables tend to be somewhat fragmentary, with things
stubbed out that I don't need at the moment. Right now I don't
have anything that actually calls daemonize(), and it would take me
a while to set something up. You should be able to test this change
better than I can.
Upon looking again at daemonize() I realized that the parent process
calls exit() immediately, so it doesn't need to keep any files open.
So I think I'll let the parent flush the buffers and call fcloseall(),
and let the child reopen file descriptors 0, 1, and 2. I want to
avoid having both processes flush buffers, because then the same
data may get flushed twice. I think.
The remaining issue is that if the fork fails, the present code calls
perror(), which writes to stderr -- which by that time will have
been closed. I'll send the message to the logging system instead.
Scott McKellar
http://home.swbell.net/mck9/ct/
More information about the Open-ils-dev
mailing list