helper shutdown on stdin close
authorSree Harsha Totakura <totakura@in.tum.de>
Fri, 27 Jul 2012 10:09:05 +0000 (10:09 +0000)
committerSree Harsha Totakura <totakura@in.tum.de>
Fri, 27 Jul 2012 10:09:05 +0000 (10:09 +0000)
src/testbed/gnunet-testbed-helper.c

index 942a9e5495dc0c2a862479af8d168a08672faf13..215f680b3c2ad3997e47cbb4577c082a85db989e 100644 (file)
@@ -154,6 +154,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   tokenizer = NULL;
   if (NULL != testbed)
   {
+    LOG_DEBUG ("Killing testbed\n");
     GNUNET_break (0 == GNUNET_OS_process_kill (testbed, SIGTERM));
     GNUNET_assert (GNUNET_OK == GNUNET_OS_process_wait (testbed));
     GNUNET_OS_process_destroy (testbed);
@@ -337,7 +338,7 @@ read_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
     return;  
   sread = GNUNET_DISK_file_read (stdin_fd, buf, sizeof (buf));
-  if (GNUNET_SYSERR == sread)
+  if ((GNUNET_SYSERR == sread) || (0 == sread))
   {
     GNUNET_SCHEDULER_shutdown ();
     return;
@@ -388,8 +389,7 @@ run (void *cls, char *const *args, const char *cfgfile,
 
 
 /**
- * Signal handler called for SIGCHLD.  Triggers the
- * respective handler by writing to the trigger pipe.
+ * Signal handler called for SIGCHLD.
  */
 static void
 sighandler_child_death ()