From 486ced7c11ecdd99ed6757d2646589209bc7c0fd Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Wed, 29 Nov 2017 13:13:33 -0700 Subject: [PATCH] Sprinkle some extra debugging printfs --- src/exec_monitor.c | 6 ++++++ src/signal.c | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/src/exec_monitor.c b/src/exec_monitor.c index 54e797791..602ba004d 100644 --- a/src/exec_monitor.c +++ b/src/exec_monitor.c @@ -380,8 +380,12 @@ exec_cmnd_pty(struct command_details *details, bool foreground, int errfd) /* Wait for parent to grant us the tty if we are foreground. */ if (foreground && !ISSET(details->flags, CD_EXEC_BG)) { struct timespec ts = { 0, 1000 }; /* 1us */ + sudo_debug_printf(SUDO_DEBUG_DEBUG, "%s: waiting for controlling tty", + __func__); while (tcgetpgrp(io_fds[SFD_SLAVE]) != self) nanosleep(&ts, NULL); + sudo_debug_printf(SUDO_DEBUG_DEBUG, "%s: got controlling tty", + __func__); } /* Done with the pty slave, don't leak it. */ @@ -389,6 +393,8 @@ exec_cmnd_pty(struct command_details *details, bool foreground, int errfd) close(io_fds[SFD_SLAVE]); /* Execute command; only returns on error. */ + sudo_debug_printf(SUDO_DEBUG_INFO, "executing %s in the %s", + details->command, foreground ? "foreground" : "background"); exec_cmnd(details, errfd); debug_return; diff --git a/src/signal.c b/src/signal.c index f0af73859..eef29361a 100644 --- a/src/signal.c +++ b/src/signal.c @@ -97,6 +97,10 @@ restore_signals(void) for (ss = saved_signals; ss->signo != -1; ss++) { if (ss->restore) { + sudo_debug_printf(SUDO_DEBUG_INFO, + "restoring handler for signal %d: %s", ss->signo, + ss->sa.sa_handler == SIG_IGN ? "SIG_IGN" : + ss->sa.sa_handler == SIG_DFL ? "SIG_DFL" : "???"); if (sigaction(ss->signo, &ss->sa, NULL) != 0) { sudo_warn(U_("unable to restore handler for signal %d"), ss->signo); -- 2.40.0