Commit 5621e510 authored by Wayne Davison's avatar Wayne Davison

Moved become_daemon() into clientserver.c.

parent a1d2685b
......@@ -703,35 +703,6 @@ void set_socket_options(int fd, char *options)
free(options);
}
/**
* Become a daemon, discarding the controlling terminal
**/
void become_daemon(void)
{
int i;
if (fork()) {
_exit(0);
}
/* detach from the terminal */
#ifdef HAVE_SETSID
setsid();
#elif defined TIOCNOTTY
i = open("/dev/tty", O_RDWR);
if (i >= 0) {
ioctl(i, (int)TIOCNOTTY, (char *)0);
close(i);
}
#endif
/* make sure that stdin, stdout an stderr don't stuff things
* up (library functions, for example) */
for (i = 0; i < 3; i++) {
close(i);
open("/dev/null", O_RDWR);
}
}
/**
* This is like socketpair but uses tcp. It is used by the Samba
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment