gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r29669 - gnunet/src/integration-tests


From: gnunet
Subject: [GNUnet-SVN] r29669 - gnunet/src/integration-tests
Date: Fri, 27 Sep 2013 22:01:46 +0200

Author: LRN
Date: 2013-09-27 22:01:46 +0200 (Fri, 27 Sep 2013)
New Revision: 29669

Modified:
   gnunet/src/integration-tests/connection_watchdog.c
Log:
Fix connection_watchdog to work on W32

Modified: gnunet/src/integration-tests/connection_watchdog.c
===================================================================
--- gnunet/src/integration-tests/connection_watchdog.c  2013-09-27 16:49:37 UTC 
(rev 29668)
+++ gnunet/src/integration-tests/connection_watchdog.c  2013-09-27 20:01:46 UTC 
(rev 29669)
@@ -206,9 +206,11 @@
 check_lowlevel_connections (int port, int protocol)
 {
 #ifdef MINGW
-  /* not supported */
-  return count;
+  #define DEVNULL "NUL"
 #else
+  #define DEVNULL "/dev/null"
+#endif
+
   FILE *f;
   char * cmdline;
   char * proto;
@@ -218,13 +220,25 @@
   switch (protocol) 
   {
     case tcp:
+#ifdef MINGW
+      proto = "-p TCP";
+#else
       proto = "-t";
+#endif
       break;
     case udp:
+#ifdef MINGW
+      proto = "-p UDP";
+#else
       proto = "-u";
+#endif
       break;
     case unixdomain:
+#ifdef MINGW
+      proto = "-p UNIX";
+#else
       proto = "-x";
+#endif
       break;
     default:
       proto = "";
@@ -234,8 +248,8 @@
   /* Use netstat to get a numeric list of all connections on port 'port' in 
state 'ESTABLISHED' */
   GNUNET_asprintf(&cmdline, "netstat -n %s | grep %u | grep ESTABLISHED", 
proto, port);
 
-  if (system ("netstat -n > /dev/null 2> /dev/null"))
-    if (system ("netstat -n > /dev/null 2> /dev/null") == 0)
+  if (system ("netstat -n > " DEVNULL " 2> " DEVNULL))
+    if (system ("netstat -n > " DEVNULL " 2> "DEVNULL) == 0)
       f = popen (cmdline, "r");
     else
       f = NULL;
@@ -263,7 +277,6 @@
   pclose (f);
   GNUNET_free (cmdline);
   return count;
-#endif
 }
 
 




reply via email to

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