- exit with a non-zero exit code if open_sockets() fails
signal(SIGPIPE, SIGNAL_CAST sig_pipe);
signal(SIGCLD, SIGNAL_CAST SIG_DFL);
#endif
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();
/* close our standard file descriptors */
close_low_fds();
- 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);
}
exit_server("normal exit");
return(0);
}