gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r28953 - libmicrohttpd/src/testspdy


From: gnunet
Subject: [GNUnet-SVN] r28953 - libmicrohttpd/src/testspdy
Date: Mon, 2 Sep 2013 19:56:25 +0200

Author: andreyu
Date: 2013-09-02 19:56:25 +0200 (Mon, 02 Sep 2013)
New Revision: 28953

Modified:
   libmicrohttpd/src/testspdy/test_proxies.c
Log:
test_proxies: info which process dies

Modified: libmicrohttpd/src/testspdy/test_proxies.c
===================================================================
--- libmicrohttpd/src/testspdy/test_proxies.c   2013-09-02 17:08:23 UTC (rev 
28952)
+++ libmicrohttpd/src/testspdy/test_proxies.c   2013-09-02 17:56:25 UTC (rev 
28953)
@@ -85,6 +85,7 @@
 {
   //pid_t child;
        int childstatus;
+       pid_t wpid;
   
        parent = getpid();
        mhd_port = get_port(4000);
@@ -95,7 +96,7 @@
        if (child_mhd == 0)
        {
     //run MHD
-               int devnull;
+               pid_t devnull;
     char *port_s;
 
                close(1);
@@ -117,7 +118,7 @@
        if (child_spdy2http == 0)
        {
     //run spdy2http
-               int devnull;
+               pid_t devnull;
     char *port_s;
     //char *url;
 
@@ -141,7 +142,7 @@
        if (child_mhd2spdy == 0)
        {
     //run MHD2sdpy
-               int devnull;
+               pid_t devnull;
     char *port_s;
     char *url;
 
@@ -166,7 +167,7 @@
        {
     //run curl
     FILE *p;
-               int devnull;
+               pid_t devnull;
                char *cmd;
     unsigned int i;
     char buf[strlen(EXPECTED_BODY) + 1];
@@ -200,18 +201,35 @@
   
   do
   {
-    if(waitpid(child_mhd,&childstatus,WNOHANG) == child_mhd
-     || waitpid(child_spdy2http,&childstatus,WNOHANG) == child_spdy2http
-     || waitpid(child_mhd2spdy,&childstatus,WNOHANG) == child_mhd2spdy)
-     {
-    killchildren();
-    return 1;
-     }
-     if(waitpid(child_curl,&childstatus,WNOHANG) == child_curl)
-     {
-    killchildren();
-    return WEXITSTATUS(childstatus);
-     }
+    wpid = waitpid(child_mhd,&childstatus,WNOHANG);
+    if(wpid == child_mhd)
+    {
+      fprintf(stderr, "mhd died unexpectedly\n");
+      killchildren();
+      return 1;
+    }
+    
+    wpid = waitpid(child_spdy2http,&childstatus,WNOHANG);
+    if(wpid == child_spdy2http)
+    {
+      fprintf(stderr, "spdy2http died unexpectedly\n");
+      killchildren();
+      return 1;
+    }
+    
+    wpid = waitpid(child_mhd2spdy,&childstatus,WNOHANG);
+    if(wpid == child_mhd2spdy)
+    {
+      fprintf(stderr, "mhd2spdy died unexpectedly\n");
+      killchildren();
+      return 1;
+    }
+    
+    if(waitpid(child_curl,&childstatus,WNOHANG) == child_curl)
+    {
+      killchildren();
+      return WEXITSTATUS(childstatus);
+    }
     sleep(1);
   }
        while(true);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]