tolerate spurious SIGCHLD in gnunet-auto-share
authorChristian Grothoff <christian@grothoff.org>
Tue, 18 Aug 2015 18:00:21 +0000 (18:00 +0000)
committerChristian Grothoff <christian@grothoff.org>
Tue, 18 Aug 2015 18:00:21 +0000 (18:00 +0000)
src/fs/gnunet-auto-share.c

index fc85b29e45f79121cc5c3fe116ae44b28f19b795..ae332af49f626204deb543cbdb5da663121f5bd9 100644 (file)
@@ -378,6 +378,8 @@ maint_child_death (void *cls,
                                      &maint_child_death, wi);
     return;
   }
+  /* consume the signal */
+  GNUNET_break (0 < GNUNET_DISK_file_read (pr, &c, sizeof (c)));
 
   ret = GNUNET_OS_process_status (publish_proc,
                                  &type,
@@ -385,21 +387,20 @@ maint_child_death (void *cls,
   GNUNET_assert (GNUNET_SYSERR != ret);
   if (GNUNET_NO == ret)
   {
-    /* process still running? Well, how did we get here?
-       Anyway, answer is to kill it! */
+    /* process still running? Then where did the SIGCHLD come from?
+       Well, let's declare it spurious (kernel bug?) and keep rolling.
+    */  
     GNUNET_break (0);
-    GNUNET_OS_process_kill (publish_proc, 
-                           SIGKILL);
-    ret = GNUNET_OS_process_status (publish_proc,
-                                   &type,
-                                   &code);
+    run_task =
+      GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
+                                     pr,
+                                     &maint_child_death, wi);
+    return;
   }
   GNUNET_assert (GNUNET_OK == ret);
   
   GNUNET_OS_process_destroy (publish_proc);
   publish_proc = NULL;
-  /* consume the signal */
-  GNUNET_break (0 < GNUNET_DISK_file_read (pr, &c, sizeof (c)));
 
   if (GNUNET_YES == do_shutdown)
   {