diff options
author | Andrew Tridgell <tridge@samba.org> | 1996-05-05 03:04:19 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 1996-05-05 03:04:19 +0000 |
commit | 52fc872aec226258aa88c6676625ce2485257678 (patch) | |
tree | fcb9590e63bd1c68ee744b28e06f4ecc8c73c543 | |
parent | fcfe0021384f0a55c2683ce517d39b306525aba0 (diff) | |
download | samba-52fc872aec226258aa88c6676625ce2485257678.tar.gz samba-52fc872aec226258aa88c6676625ce2485257678.tar.bz2 samba-52fc872aec226258aa88c6676625ce2485257678.zip |
- close the listening socket in the child process when running as a daemon
- exit with a non-zero exit code if open_sockets() fails
(This used to be commit 83866f3c84bd53a68f4937dddf4903eee7a00aaf)
-rw-r--r-- | source3/smbd/server.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 605e98be0f..c77a5ca8a7 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -2225,6 +2225,9 @@ static BOOL open_sockets(BOOL is_daemon,int port) signal(SIGPIPE, SIGNAL_CAST sig_pipe); signal(SIGCLD, SIGNAL_CAST SIG_DFL); #endif + /* close the listening socket */ + close(s); + /* close our standard file descriptors */ close_low_fds(); @@ -4280,22 +4283,23 @@ int main(int argc,char *argv[]) become_daemon(); } - if (open_sockets(is_daemon,port)) - { - /* possibly reload the services file. */ - reload_services(True); + if (!open_sockets(is_daemon,port)) + exit(1); - maxxmit = MIN(lp_maxxmit(),BUFFER_SIZE); + /* possibly reload the services file. */ + reload_services(True); - if (*lp_rootdir()) - { - if (sys_chroot(lp_rootdir()) == 0) - DEBUG(2,("%s changed root to %s\n",timestring(),lp_rootdir())); - } + maxxmit = MIN(lp_maxxmit(),BUFFER_SIZE); - process(); - close_sockets(); + if (*lp_rootdir()) + { + if (sys_chroot(lp_rootdir()) == 0) + DEBUG(2,("%s changed root to %s\n",timestring(),lp_rootdir())); } + + process(); + close_sockets(); + exit_server("normal exit"); return(0); } |