Moved become_daemon() into clientserver.c.
[rsync/rsync.git] / socket.c
index ca8c561..6bedc99 100644 (file)
--- a/socket.c
+++ b/socket.c
@@ -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