> > I have a (possibly naive) snippet of code from another type of
> > daemon process where the files are properly closed:
> >
> > /* Become a daemon */
> > pid = fork();
> > if (pid > 0) { /* Parent */
> > /* Close parent's streams */
> > fclose (stdin);
> > fclose (stdout);
> > fclose (stderr);
> > return(0);
> > } else if (pid < 0) { /* Error */
> > printf("%s: Could not fork child process\n", argv[0]);
> > return(-1);
> > }
> >
> > The Maui code in src/server/OServer.c doesn't close file descriptors,
> > which IMHO it ought to do. Ronny has even more detailed suggestions
> > above which I don't claim to understand fully.*closing* is a bad idea because you don't want those descriptors to be reused by future function calls. Imagine some random debug printf() going to some all-important network socket that happened to get fd 2. You really want them to be associated with /dev/null.
pgpYilISThIoW.pgp
Description: PGP signature
_______________________________________________ mauiusers mailing list [email protected] http://www.supercluster.org/mailman/listinfo/mauiusers
