mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
- 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 83866f3c84
)
This commit is contained in:
parent
fcfe002138
commit
52fc872aec
@ -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))
|
||||
if (!open_sockets(is_daemon,port))
|
||||
exit(1);
|
||||
|
||||
/* possibly reload the services file. */
|
||||
reload_services(True);
|
||||
|
||||
maxxmit = MIN(lp_maxxmit(),BUFFER_SIZE);
|
||||
|
||||
if (*lp_rootdir())
|
||||
{
|
||||
/* possibly reload the services file. */
|
||||
reload_services(True);
|
||||
|
||||
maxxmit = MIN(lp_maxxmit(),BUFFER_SIZE);
|
||||
|
||||
if (*lp_rootdir())
|
||||
{
|
||||
if (sys_chroot(lp_rootdir()) == 0)
|
||||
DEBUG(2,("%s changed root to %s\n",timestring(),lp_rootdir()));
|
||||
}
|
||||
|
||||
process();
|
||||
close_sockets();
|
||||
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user