Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37563564
en ru br
ALT Linux repos
S:2.5.0-alt1
5.0: 2.4.4-alt11
4.1: 2.4.4-alt10.M41.1
4.0: 2.4.4-alt10
+updates:2.4.4-alt10
3.0: 2.4.2-alt6
+updates:2.4.2-alt6.M30.1

Group :: Networking/Other
RPM: ppp

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: ppp-2.4.4-alt-killmypg.patch
Download


diff -ur ppp-2.4.4.orig/pppd/main.c ppp-2.4.4.killmypg/pppd/main.c
--- ppp-2.4.4.orig/pppd/main.c	2006-06-04 07:52:50 +0400
+++ ppp-2.4.4.killmypg/pppd/main.c	2007-03-18 03:37:50 +0300
@@ -234,7 +234,6 @@
 static void get_input __P((void));
 static void calltimeout __P((void));
 static struct timeval *timeleft __P((struct timeval *));
-static void kill_my_pg __P((int));
 static void hup __P((int));
 static void term __P((int));
 static void chld __P((int));
@@ -1375,36 +1374,6 @@
 
 
 /*
- * kill_my_pg - send a signal to our process group, and ignore it ourselves.
- * We assume that sig is currently blocked.
- */
-static void
-kill_my_pg(sig)
-    int sig;
-{
-    struct sigaction act, oldact;
-
-    sigemptyset(&act.sa_mask);		/* unnecessary in fact */
-    act.sa_handler = SIG_IGN;
-    act.sa_flags = 0;
-    kill(0, sig);
-    /*
-     * The kill() above made the signal pending for us, as well as
-     * the rest of our process group, but we don't want it delivered
-     * to us.  It is blocked at the moment.  Setting it to be ignored
-     * will cause the pending signal to be discarded.  If we did the
-     * kill() after setting the signal to be ignored, it is unspecified
-     * (by POSIX) whether the signal is immediately discarded or left
-     * pending, and in fact Linux would leave it pending, and so it
-     * would be delivered after the current signal handler exits,
-     * leading to an infinite loop.
-     */
-    sigaction(sig, &act, &oldact);
-    sigaction(sig, &oldact, NULL);
-}
-
-
-/*
  * hup - Catch SIGHUP signal.
  *
  * Indicates that the physical layer has been disconnected.
@@ -1415,11 +1384,20 @@
 hup(sig)
     int sig;
 {
+    static ignore_next = 0;
+    if(ignore_next)
+    {
+        ignore_next = 0;
+        return;
+    }
     /* can't log a message here, it can deadlock */
     got_sighup = 1;
     if (conn_running)
+    {
 	/* Send the signal to the [dis]connector process(es) also */
-	kill_my_pg(sig);
+	ignore_next = 1;
+	kill(0, sig);
+    }
     notify(sigreceived, sig);
     if (waiting)
 	siglongjmp(sigjmp, 1);
@@ -1436,11 +1414,19 @@
 term(sig)
     int sig;
 {
+    static ignore_next = 0;
+    if(ignore_next)
+    {
+        ignore_next = 0;
+    }
     /* can't log a message here, it can deadlock */
     got_sigterm = sig;
     if (conn_running)
-	/* Send the signal to the [dis]connector process(es) also */
-	kill_my_pg(sig);
+    {
+        /* Send the signal to the [dis]connector process(es) also */
+        ignore_next = 1;
+        kill(0, sig);
+    }
     notify(sigreceived, sig);
     if (waiting)
 	siglongjmp(sigjmp, 1);
@@ -1503,14 +1489,23 @@
 bad_signal(sig)
     int sig;
 {
+    static ignore_next = 0;
     static int crashed = 0;
-
+    
+    if(ignore_next)
+    {
+        ignore_next = 0;
+        return;
+    }
     if (crashed)
 	_exit(127);
     crashed = 1;
     error("Fatal signal %d", sig);
     if (conn_running)
-	kill_my_pg(SIGTERM);
+    {
+        ignore_next = 1;
+        kill(0, SIGTERM);
+    }
     notify(sigreceived, sig);
     die(127);
 }
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin