mirror of
https://github.com/samba-team/samba.git
synced 2025-08-03 04:22:09 +03:00
nmbd: use exit_daemon() to report status to systemd
BUG: https://bugzilla.samba.org/show_bug.cgi?id=10517 Signed-off-by: Alexander Bokovoy <ab@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
committed by
Jeremy Allison
parent
02a3b598a5
commit
6771c23aa0
@ -975,16 +975,12 @@ static bool open_sockets(bool isdaemon, int port)
|
||||
|
||||
ok = directory_create_or_exist(lp_lock_directory(), geteuid(), 0755);
|
||||
if (!ok) {
|
||||
DEBUG(0, ("Failed to create directory %s for lock files - %s\n",
|
||||
lp_lock_directory(), strerror(errno)));
|
||||
exit(1);
|
||||
exit_daemon("Failed to create directory for lock files, check 'lock directory'", errno);
|
||||
}
|
||||
|
||||
ok = directory_create_or_exist(lp_pid_directory(), geteuid(), 0755);
|
||||
if (!ok) {
|
||||
DEBUG(0, ("Failed to create directory %s for pid files - %s\n",
|
||||
lp_pid_directory(), strerror(errno)));
|
||||
exit(1);
|
||||
exit_daemon("Failed to create directory for pid files, check 'pid directory'", errno);
|
||||
}
|
||||
|
||||
pidfile_create(lp_pid_directory(), "nmbd");
|
||||
@ -993,8 +989,7 @@ static bool open_sockets(bool isdaemon, int port)
|
||||
false);
|
||||
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DEBUG(0,("reinit_after_fork() failed\n"));
|
||||
exit(1);
|
||||
exit_daemon("reinit_after_fork() failed", map_errno_from_nt_status(status));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1004,16 +999,15 @@ static bool open_sockets(bool isdaemon, int port)
|
||||
*/
|
||||
status = init_before_fork();
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DEBUG(0, ("init_before_fork failed: %s\n", nt_errstr(status)));
|
||||
exit(1);
|
||||
exit_daemon(nt_errstr(status), map_errno_from_nt_status(status));
|
||||
}
|
||||
|
||||
if (!nmbd_setup_sig_term_handler(msg))
|
||||
exit(1);
|
||||
exit_daemon("NMBD failed to setup signal handler", EINVAL);
|
||||
if (!nmbd_setup_stdin_handler(msg, !Fork))
|
||||
exit(1);
|
||||
exit_daemon("NMBD failed to setup stdin handler", EINVAL);
|
||||
if (!nmbd_setup_sig_hup_handler(msg))
|
||||
exit(1);
|
||||
exit_daemon("NMBD failed to setup SIGHUP handler", EINVAL);
|
||||
|
||||
/* get broadcast messages */
|
||||
|
||||
@ -1021,8 +1015,7 @@ static bool open_sockets(bool isdaemon, int port)
|
||||
FLAG_MSG_GENERAL |
|
||||
FLAG_MSG_NMBD |
|
||||
FLAG_MSG_DBWRAP)) {
|
||||
DEBUG(1, ("Could not register myself in serverid.tdb\n"));
|
||||
exit(1);
|
||||
exit_daemon("Could not register NMBD process in serverid.tdb", EACCES);
|
||||
}
|
||||
|
||||
messaging_register(msg, NULL, MSG_FORCE_ELECTION,
|
||||
@ -1053,9 +1046,8 @@ static bool open_sockets(bool isdaemon, int port)
|
||||
|
||||
/* Create an nmbd subnet record for each of the above. */
|
||||
if( False == create_subnets() ) {
|
||||
DEBUG(0,("ERROR: Failed when creating subnet lists. Exiting.\n"));
|
||||
kill_async_dns_child();
|
||||
exit(1);
|
||||
exit_daemon("NMBD failed when creating subnet lists", EACCES);
|
||||
}
|
||||
|
||||
/* Load in any static local names. */
|
||||
@ -1067,9 +1059,8 @@ static bool open_sockets(bool isdaemon, int port)
|
||||
|
||||
/* If we are acting as a WINS server, initialise data structures. */
|
||||
if( !initialise_wins() ) {
|
||||
DEBUG( 0, ( "nmbd: Failed when initialising WINS server.\n" ) );
|
||||
kill_async_dns_child();
|
||||
exit(1);
|
||||
exit_daemon( "NMBD failed when initialising WINS server.", EACCES);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1081,21 +1072,19 @@ static bool open_sockets(bool isdaemon, int port)
|
||||
*/
|
||||
|
||||
if( False == register_my_workgroup_and_names() ) {
|
||||
DEBUG(0,("ERROR: Failed when creating my my workgroup. Exiting.\n"));
|
||||
kill_async_dns_child();
|
||||
exit(1);
|
||||
exit_daemon( "NMBD failed when creating my workgroup.", EACCES);
|
||||
}
|
||||
|
||||
if (!initialize_nmbd_proxy_logon()) {
|
||||
DEBUG(0,("ERROR: Failed setup nmbd_proxy_logon.\n"));
|
||||
kill_async_dns_child();
|
||||
exit(1);
|
||||
exit_daemon( "NMBD failed to setup nmbd_proxy_logon.", EACCES);
|
||||
}
|
||||
|
||||
if (!nmbd_init_packet_server()) {
|
||||
kill_async_dns_child();
|
||||
exit(1);
|
||||
}
|
||||
exit_daemon( "NMBD failed to setup packet server.", EACCES);
|
||||
}
|
||||
|
||||
if (is_daemon && !opt_interactive) {
|
||||
daemon_ready("nmbd");
|
||||
|
Reference in New Issue
Block a user