summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/chat.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1997-02-19 01:14:41 +0000
committerbrian <brian@FreeBSD.org>1997-02-19 01:14:41 +0000
commit43a90c7d71583db5ceb070df332fab67e4414c6a (patch)
tree8161cb2acbf7411d686ea3f206c18cec51516bac /usr.sbin/ppp/chat.c
parent87dca7091fa198d5f1e715636074dafb9e3ce7a9 (diff)
downloadFreeBSD-src-43a90c7d71583db5ceb070df332fab67e4414c6a.zip
FreeBSD-src-43a90c7d71583db5ceb070df332fab67e4414c6a.tar.gz
Tidy up signal handling.
All signal() calls have been changed to pending_signal() calls. pending_signal() is defined in the new sig.c file. It remembers the handler and traps the signal with a function that will remember the signal. main.c now calls handle_signals() to actually call the required handlers (if the above handler was called). If this doesn't close PR2662 (was PR2347), I'll cry. Joerg, I think this should go into 2.2, but I havn't done anything about it because I'm bound to botch it with the new sig.[ch] files. I've just "cvs add"'d sig.[ch] so far.... can you update to 2.2 and tell me what you did ? Thanks.
Diffstat (limited to 'usr.sbin/ppp/chat.c')
-rw-r--r--usr.sbin/ppp/chat.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.sbin/ppp/chat.c b/usr.sbin/ppp/chat.c
index 29f989c..25a33d3 100644
--- a/usr.sbin/ppp/chat.c
+++ b/usr.sbin/ppp/chat.c
@@ -34,7 +34,7 @@
#include <sys/time.h>
#include <fcntl.h>
#include <errno.h>
-#include <signal.h>
+#include "sig.h"
#include <sys/wait.h>
#include "timeout.h"
#include "vars.h"
@@ -402,16 +402,16 @@ char *command, *out;
pipe(fids);
pid = fork();
if (pid == 0) {
- signal(SIGINT, SIG_DFL);
- signal(SIGQUIT, SIG_DFL);
- signal(SIGTERM, SIG_DFL);
- signal(SIGHUP, SIG_DFL);
+ pending_signal(SIGINT, SIG_DFL);
+ pending_signal(SIGQUIT, SIG_DFL);
+ pending_signal(SIGTERM, SIG_DFL);
+ pending_signal(SIGHUP, SIG_DFL);
close(fids[0]);
dup2(fids[1], 1);
close(fids[1]);
nb = open("/dev/tty", O_RDWR);
dup2(nb, 0);
-LogPrintf(LOG_CHAT_BIT, "exec: %s\n", command);
+ LogPrintf(LOG_CHAT_BIT, "exec: %s\n", command);
/* switch back to original privileges */
if (setgid(getgid()) < 0) {
LogPrintf(LOG_CHAT_BIT, "setgid: %s\n", strerror(errno));
OpenPOWER on IntegriCloud