From: Jeremy Allison Date: Fri, 31 Mar 2017 19:29:03 +0000 (-0700) Subject: s4: server: Add error return checks for tevent_add_fde, tevent_add_timer. X-Git-Tag: tdb-1.3.13~86 X-Git-Url: http://git.samba.org/samba.git/?p=bbaumbach%2Fsamba-autobuild%2F.git;a=commitdiff_plain;h=139793ce06ed5611d3eb37fc09f974265289ec55 s4: server: Add error return checks for tevent_add_fde, tevent_add_timer. Signed-off-by: Jeremy Allison Reviewed-by: Volker Lendecke --- diff --git a/source4/smbd/server.c b/source4/smbd/server.c index d80a94db785..1e5d57940ce 100644 --- a/source4/smbd/server.c +++ b/source4/smbd/server.c @@ -497,23 +497,30 @@ static int binary_smbd_main(const char *binary_name, } if (S_ISFIFO(st.st_mode) || S_ISSOCK(st.st_mode)) { - tevent_add_fd(state->event_ctx, + struct tevent_fd *fde = tevent_add_fd(state->event_ctx, state->event_ctx, 0, stdin_event_flags, server_stdin_handler, state); + if (fde == NULL) { + exit_daemon("Initializing stdin failed", ENOMEM); + } } if (max_runtime) { + struct tevent_timer *te; DEBUG(0,("%s PID %d was called with maxruntime %d - " "current ts %llu\n", binary_name, (int)getpid(), max_runtime, (unsigned long long) time(NULL))); - tevent_add_timer(state->event_ctx, state->event_ctx, + te = tevent_add_timer(state->event_ctx, state->event_ctx, timeval_current_ofs(max_runtime, 0), max_runtime_handler, state); + if (te == NULL) { + exit_daemon("Maxruntime handler failed", ENOMEM); + } } if (lpcfg_server_role(cmdline_lp_ctx) != ROLE_ACTIVE_DIRECTORY_DC