(disassoc): Rewrite for POSIX, return status. Caller changed.

Problems with the old code:
* Insufficient error checking.
* It used TIOCNOTTY (obsolete BSDism) to get rid of the controlling
  tty, except for hpux || Rel4, where it attempted to use the POSIX
  way, but screwed up.
* It left file descriptors 0, 1, 2 in a somewhat weird state.
This commit is contained in:
Markus Armbruster 2005-10-25 18:42:03 +00:00
parent 551263cb07
commit a6a87af6ed
4 changed files with 44 additions and 34 deletions

View file

@ -235,8 +235,12 @@ main(int argc, char **argv)
}
daemonize = 0;
#else /* !_WIN32 */
if (daemonize)
disassoc();
if (daemonize) {
if (disassoc() < 0) {
logerror("Can't become daemon (%s)", strerror(errno));
_exit(1);
}
}
#endif /* !_WIN32 */
start_server(flags);