check parent pid, die if gone
authorNathan S. Evans <evans@in.tum.de>
Thu, 2 Sep 2010 08:30:11 +0000 (08:30 +0000)
committerNathan S. Evans <evans@in.tum.de>
Thu, 2 Sep 2010 08:30:11 +0000 (08:30 +0000)
src/transport/gnunet-nat-server.c

index 7892d8f93cd362fca74f459e090fa305f604b715..0743c92df41fa7e5a1c7767eafa70c73661ecfd1 100644 (file)
@@ -631,6 +631,8 @@ main (int argc,
                   strerror (errno));
          break;
        }
+      if (1 == getppid()) /* Check the parent process id, if 1 the parent has died, so we should die too */
+        break;
       if (FD_ISSET (icmpsock, &rs))
        process_icmp_response ();
       if (0 == (++alt % 2))