diff options
Diffstat (limited to 'source4/smbd/server.c')
-rw-r--r-- | source4/smbd/server.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/source4/smbd/server.c b/source4/smbd/server.c index 1a90592fcd..8f5c3b66ec 100644 --- a/source4/smbd/server.c +++ b/source4/smbd/server.c @@ -39,6 +39,7 @@ #include "param/secrets.h" #include "smbd/pidfile.h" #include "cluster/ctdb/ctdb_cluster.h" +#include "param/param.h" /* recursively delete a directory tree @@ -92,7 +93,7 @@ static void cleanup_tmp_files(void) char *path; TALLOC_CTX *mem_ctx = talloc_new(NULL); - path = smbd_tmp_path(mem_ctx, NULL); + path = smbd_tmp_path(mem_ctx, global_loadparm, NULL); recursive_delete(path); talloc_free(mem_ctx); @@ -122,25 +123,25 @@ static void sig_term(int sig) static void setup_signals(void) { /* we are never interested in SIGPIPE */ - BlockSignals(True,SIGPIPE); + BlockSignals(true,SIGPIPE); #if defined(SIGFPE) /* we are never interested in SIGFPE */ - BlockSignals(True,SIGFPE); + BlockSignals(true,SIGFPE); #endif /* We are no longer interested in USR1 */ - BlockSignals(True, SIGUSR1); + BlockSignals(true, SIGUSR1); #if defined(SIGUSR2) /* We are no longer interested in USR2 */ - BlockSignals(True,SIGUSR2); + BlockSignals(true,SIGUSR2); #endif /* POSIX demands that signals are inherited. If the invoking process has * these signals masked, we will have problems, as we won't recieve them. */ - BlockSignals(False, SIGHUP); - BlockSignals(False, SIGTERM); + BlockSignals(false, SIGHUP); + BlockSignals(false, SIGTERM); CatchSignal(SIGHUP, sig_hup); CatchSignal(SIGTERM, sig_term); @@ -152,7 +153,7 @@ static void setup_signals(void) static void server_stdin_handler(struct event_context *event_ctx, struct fd_event *fde, uint16_t flags, void *private) { - const char *binary_name = private; + const char *binary_name = (const char *)private; uint8_t c; if (read(0, &c, 1) == 0) { DEBUG(0,("%s: EOF on stdin - terminating\n", binary_name)); @@ -168,10 +169,11 @@ static void server_stdin_handler(struct event_context *event_ctx, struct fd_even /* die if the user selected maximum runtime is exceeded */ -static void max_runtime_handler(struct event_context *ev, struct timed_event *te, - struct timeval t, void *private) +_NORETURN_ static void max_runtime_handler(struct event_context *ev, + struct timed_event *te, + struct timeval t, void *private) { - const char *binary_name = private; + const char *binary_name = (const char *)private; DEBUG(0,("%s: maximum runtime exceeded - terminating\n", binary_name)); exit(0); } @@ -267,8 +269,8 @@ static int binary_smbd_main(const char *binary_name, int argc, const char *argv[ cleanup_tmp_files(); - if (!directory_exist(lp_lockdir())) { - mkdir(lp_lockdir(), 0755); + if (!directory_exist(lp_lockdir(global_loadparm))) { + mkdir(lp_lockdir(global_loadparm), 0755); } pidfile_create(binary_name); @@ -294,7 +296,7 @@ static int binary_smbd_main(const char *binary_name, int argc, const char *argv[ process_model_init(); - shared_init = load_samba_modules(NULL, "service"); + shared_init = load_samba_modules(NULL, global_loadparm, "service"); run_init_functions(static_init); run_init_functions(shared_init); @@ -305,6 +307,11 @@ static int binary_smbd_main(const char *binary_name, int argc, const char *argv[ should hang off that */ event_ctx = event_context_init(talloc_autofree_context()); + if (event_ctx == NULL) { + DEBUG(0,("Initializing event context failed\n")); + return 1; + } + /* initialise clustering if needed */ cluster_ctdb_init(event_ctx, model); @@ -327,7 +334,7 @@ static int binary_smbd_main(const char *binary_name, int argc, const char *argv[ } DEBUG(0,("%s: using '%s' process model\n", binary_name, model)); - status = server_service_startup(event_ctx, model, lp_server_services()); + status = server_service_startup(event_ctx, model, lp_server_services(global_loadparm)); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("Starting Services failed - %s\n", nt_errstr(status))); return 1; |