-check misc return values
authorChristian Grothoff <christian@grothoff.org>
Wed, 20 Jun 2012 10:55:25 +0000 (10:55 +0000)
committerChristian Grothoff <christian@grothoff.org>
Wed, 20 Jun 2012 10:55:25 +0000 (10:55 +0000)
src/nse/gnunet-nse-profiler.c
src/transport/gnunet-transport-certificate-creation.c
src/transport/gnunet-transport-wlan-sender.c

index cf88690d5c85e88b228d82285fd83dbd160ed6c6..19adb2064b21d3f4e238ff9a29bcbfa2b404ca26 100644 (file)
@@ -182,17 +182,13 @@ shutdown_callback (void *cls, const char *emsg)
 {
   if (emsg != NULL)
   {
-#if VERBOSE
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown of peers failed!\n");
-#endif
     if (ok == 0)
       ok = 666;
   }
   else
   {
-#if VERBOSE
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All peers successfully shut down!\n");
-#endif
     ok = 0;
   }
 }
@@ -203,10 +199,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct NSEPeer *pos;
 
-#if VERBOSE
-  FPRINTF (stderr, "%s",  "Ending test.\n");
-#endif
-
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ending test.\n");
   if (disconnect_task != GNUNET_SCHEDULER_NO_TASK)
   {
     GNUNET_SCHEDULER_cancel (disconnect_task);
@@ -366,19 +359,15 @@ connect_nse_service (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   struct NSEPeer *current_peer;
   unsigned int i;
 
-#if VERBOSE
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting to nse service of peers\n");
-#endif
   for (i = 0; i < num_peers; i++)
   {
     if ((connection_limit > 0) &&
        (num_peers > connection_limit) && 
        (i % (num_peers / connection_limit) != 0))
       continue;
-#if VERBOSE
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "nse-profiler: connecting to nse service of peer %d\n", i);
-#endif
     current_peer = GNUNET_malloc (sizeof (struct NSEPeer));
     current_peer->daemon = GNUNET_TESTING_daemon_get (pg, i);
     if (GNUNET_YES ==
@@ -747,10 +736,8 @@ my_cb (void *cls, const char *emsg)
     GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
     return;
   }
-#if VERBOSE
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Peer Group started successfully, connecting to NSE service for each peer!\n");
-#endif
   GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Have %u connections\n",
               total_connections);
   if (data_file != NULL)
@@ -806,8 +793,8 @@ run (void *cls, char *const *args, const char *cfgfile,
   ok = 1;
   //testing_cfg = GNUNET_CONFIGURATION_create ();
   testing_cfg = GNUNET_CONFIGURATION_dup (cfg);
-#if VERBOSE
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting daemons.\n");
+#if VERBOSE
   GNUNET_CONFIGURATION_set_value_string (testing_cfg, "testing",
                                          "use_progressbars", "YES");
 #endif
@@ -920,16 +907,14 @@ main (int argc, char *const *argv)
     return 2;
 
   GNUNET_log_setup ("nse-profiler",
-#if VERBOSE
-                    "DEBUG",
-#else
                     "WARNING",
-#endif
                     NULL);
-  GNUNET_PROGRAM_run (argc, argv, "nse-profiler",
-                      gettext_noop
-                      ("Measure quality and performance of the NSE service."),
-                      options, &run, NULL);
+  if (GNUNET_OK !=
+      GNUNET_PROGRAM_run (argc, argv, "nse-profiler",
+                         gettext_noop
+                         ("Measure quality and performance of the NSE service."),
+                         options, &run, NULL))
+    ok = 1;
 #if REMOVE_DIR
   GNUNET_DISK_directory_remove ("/tmp/nse-profiler");
 #endif
index c4c13dc2a277e5ef245936d905747725b3c35883..d5a7fcbd13932887e82909b3ba339642fd7e60b4 100644 (file)
@@ -53,7 +53,7 @@ main (int argc, char **argv)
   if (argc != 3)
     return 1;
   removecerts (argv[1], argv[2]);
-  close (2);                    /* eliminate stderr */
+  (void) close (2);                    /* eliminate stderr */
   /* Create RSA Private Key */
   /* openssl genrsa -out $1 1024 2> /dev/null */
   openssl =
index daa8f026970f60fbbe03f88713bc26ad50952dac..c5718b858fb9e322447a72be9b8851a439022436 100644 (file)
@@ -163,7 +163,10 @@ main (int argc, char *argv[])
   if (pid)
   {
     /* A positive (non-negative) PID indicates the parent process */
-    close (commpipe[0]);        /* Close unused side of pipe (in side) */
+    if (0 != close (commpipe[0]))        /* Close unused side of pipe (in side) */
+      fprintf (stderr,
+              "Failed to close fd: %s\n",
+              strerror (errno));
     setvbuf (stdout, (char *) NULL, _IONBF, 0); /* Set non-buffered output on stdout */