diff --git a/apps/su.cpp b/apps/su.cpp index a0c95f6c..cd965894 100644 --- a/apps/su.cpp +++ b/apps/su.cpp @@ -14,10 +14,10 @@ void restore_terminal() ioctl(fileno(stdin), TCSETS, &orig); } -void sigint_handler(int) +void signal_handler(int signo) { restore_terminal(); - raise(SIGINT); + raise(signo); } char* getpass() @@ -41,10 +41,12 @@ char* getpass() } struct sigaction sa; - sa.sa_handler = sigint_handler; + sa.sa_handler = signal_handler; sigemptyset(&sa.sa_mask); sa.sa_flags = SA_RESETHAND; sigaction(SIGINT, &sa, NULL); + sigaction(SIGTERM, &sa, NULL); + sigaction(SIGQUIT, &sa, NULL); atexit(restore_terminal);