Replace sudo_fatal(NULL) with an "unable to allocate memory" message

that includes the function name.
This commit is contained in:
Todd C. Miller
2018-10-12 08:39:12 -06:00
parent 9e269e0acd
commit b89cf34b53
4 changed files with 41 additions and 41 deletions

View File

@@ -204,13 +204,13 @@ fill_exec_closure_nopty(struct exec_closure_nopty *ec,
/* Setup event base and events. */
ec->evbase = sudo_ev_base_alloc();
if (ec->evbase == NULL)
sudo_fatal(NULL);
sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
/* Event for command status via errfd. */
ec->errpipe_event = sudo_ev_alloc(errfd,
SUDO_EV_READ|SUDO_EV_PERSIST, errpipe_cb, ec);
if (ec->errpipe_event == NULL)
sudo_fatal(NULL);
sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
if (sudo_ev_add(ec->evbase, ec->errpipe_event, NULL, false) == -1)
sudo_fatal(U_("unable to add event to queue"));
sudo_debug_printf(SUDO_DEBUG_INFO, "error pipe fd %d\n", errfd);
@@ -219,77 +219,77 @@ fill_exec_closure_nopty(struct exec_closure_nopty *ec,
ec->sigint_event = sudo_ev_alloc(SIGINT,
SUDO_EV_SIGINFO, signal_cb_nopty, ec);
if (ec->sigint_event == NULL)
sudo_fatal(NULL);
sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
if (sudo_ev_add(ec->evbase, ec->sigint_event, NULL, false) == -1)
sudo_fatal(U_("unable to add event to queue"));
ec->sigquit_event = sudo_ev_alloc(SIGQUIT,
SUDO_EV_SIGINFO, signal_cb_nopty, ec);
if (ec->sigquit_event == NULL)
sudo_fatal(NULL);
sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
if (sudo_ev_add(ec->evbase, ec->sigquit_event, NULL, false) == -1)
sudo_fatal(U_("unable to add event to queue"));
ec->sigtstp_event = sudo_ev_alloc(SIGTSTP,
SUDO_EV_SIGINFO, signal_cb_nopty, ec);
if (ec->sigtstp_event == NULL)
sudo_fatal(NULL);
sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
if (sudo_ev_add(ec->evbase, ec->sigtstp_event, NULL, false) == -1)
sudo_fatal(U_("unable to add event to queue"));
ec->sigterm_event = sudo_ev_alloc(SIGTERM,
SUDO_EV_SIGINFO, signal_cb_nopty, ec);
if (ec->sigterm_event == NULL)
sudo_fatal(NULL);
sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
if (sudo_ev_add(ec->evbase, ec->sigterm_event, NULL, false) == -1)
sudo_fatal(U_("unable to add event to queue"));
ec->sighup_event = sudo_ev_alloc(SIGHUP,
SUDO_EV_SIGINFO, signal_cb_nopty, ec);
if (ec->sighup_event == NULL)
sudo_fatal(NULL);
sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
if (sudo_ev_add(ec->evbase, ec->sighup_event, NULL, false) == -1)
sudo_fatal(U_("unable to add event to queue"));
ec->sigalrm_event = sudo_ev_alloc(SIGALRM,
SUDO_EV_SIGINFO, signal_cb_nopty, ec);
if (ec->sigalrm_event == NULL)
sudo_fatal(NULL);
sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
if (sudo_ev_add(ec->evbase, ec->sigalrm_event, NULL, false) == -1)
sudo_fatal(U_("unable to add event to queue"));
ec->sigpipe_event = sudo_ev_alloc(SIGPIPE,
SUDO_EV_SIGINFO, signal_cb_nopty, ec);
if (ec->sigpipe_event == NULL)
sudo_fatal(NULL);
sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
if (sudo_ev_add(ec->evbase, ec->sigpipe_event, NULL, false) == -1)
sudo_fatal(U_("unable to add event to queue"));
ec->sigusr1_event = sudo_ev_alloc(SIGUSR1,
SUDO_EV_SIGINFO, signal_cb_nopty, ec);
if (ec->sigusr1_event == NULL)
sudo_fatal(NULL);
sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
if (sudo_ev_add(ec->evbase, ec->sigusr1_event, NULL, false) == -1)
sudo_fatal(U_("unable to add event to queue"));
ec->sigusr2_event = sudo_ev_alloc(SIGUSR2,
SUDO_EV_SIGINFO, signal_cb_nopty, ec);
if (ec->sigusr2_event == NULL)
sudo_fatal(NULL);
sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
if (sudo_ev_add(ec->evbase, ec->sigusr2_event, NULL, false) == -1)
sudo_fatal(U_("unable to add event to queue"));
ec->sigchld_event = sudo_ev_alloc(SIGCHLD,
SUDO_EV_SIGINFO, signal_cb_nopty, ec);
if (ec->sigchld_event == NULL)
sudo_fatal(NULL);
sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
if (sudo_ev_add(ec->evbase, ec->sigchld_event, NULL, false) == -1)
sudo_fatal(U_("unable to add event to queue"));
ec->sigcont_event = sudo_ev_alloc(SIGCONT,
SUDO_EV_SIGINFO, signal_cb_nopty, ec);
if (ec->sigcont_event == NULL)
sudo_fatal(NULL);
sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
if (sudo_ev_add(ec->evbase, ec->sigcont_event, NULL, false) == -1)
sudo_fatal(U_("unable to add event to queue"));
@@ -297,7 +297,7 @@ fill_exec_closure_nopty(struct exec_closure_nopty *ec,
ec->siginfo_event = sudo_ev_alloc(SIGINFO,
SUDO_EV_SIGINFO, signal_cb_nopty, ec);
if (ec->siginfo_event == NULL)
sudo_fatal(NULL);
sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
if (sudo_ev_add(ec->evbase, ec->siginfo_event, NULL, false) == -1)
sudo_fatal(U_("unable to add event to queue"));
#endif