more verbose logging
authorChristian Grothoff <christian@grothoff.org>
Thu, 10 May 2018 11:37:02 +0000 (13:37 +0200)
committerChristian Grothoff <christian@grothoff.org>
Thu, 10 May 2018 11:37:02 +0000 (13:37 +0200)
src/transport/test_plugin_transport.c
src/util/disk.c

index acb3911f05afd5baa0cac10bd615ab53a807f36d..d80a134100f8b6dab911d84e36829f79aa24550b 100644 (file)
@@ -566,8 +566,10 @@ handle_helper_message (void *cls,
  * @param c configuration to use
  */
 static void
-run (void *cls, char * const *args, const char *cfgfile,
-    const struct GNUNET_CONFIGURATION_Handle *c)
+run (void *cls,
+     char * const *args,
+     const char *cfgfile,
+     const struct GNUNET_CONFIGURATION_Handle *c)
 {
   char * const *argv = cls;
   unsigned long long tneigh;
@@ -575,8 +577,9 @@ run (void *cls, char * const *args, const char *cfgfile,
   char *plugin;
   char *sep;
 
-  timeout_endbadly = GNUNET_SCHEDULER_add_delayed (TIMEOUT, end_badly, &ok);
-
+  timeout_endbadly = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
+                                                   &end_badly,
+                                                   &ok);
   cfg = c;
   /* parse configuration */
   if ((GNUNET_OK
@@ -594,7 +597,7 @@ run (void *cls, char * const *args, const char *cfgfile,
   if (NULL == (stats = GNUNET_STATISTICS_create ("transport", cfg)))
   {
     GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
-        "Could not create statistics.  Exiting.\n");
+               "Could not create statistics.  Exiting.\n");
     GNUNET_free(keyfile);
     end_badly_now ();
     return;
@@ -602,27 +605,33 @@ run (void *cls, char * const *args, const char *cfgfile,
 
   if (GNUNET_OK != GNUNET_DISK_file_test (HOSTKEY_FILE))
   {
-    GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Hostkey `%s' missing.  Exiting.\n",
-        HOSTKEY_FILE);
+    GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
+               "Hostkey `%s' missing.  Exiting.\n",
+               HOSTKEY_FILE);
     GNUNET_free(keyfile);
     end_badly_now ();
     return;
   }
 
-  if (GNUNET_OK != GNUNET_DISK_directory_create_for_file (keyfile))
+  if (GNUNET_OK !=
+      GNUNET_DISK_directory_create_for_file (keyfile))
   {
     GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
-        "Could not create a directory for hostkey `%s'.  Exiting.\n", keyfile);
+               "Could not create a directory for hostkey `%s'.  Exiting.\n",
+               keyfile);
     GNUNET_free(keyfile);
     end_badly_now ();
     return;
   }
 
-  if (GNUNET_OK != GNUNET_DISK_file_copy (HOSTKEY_FILE, keyfile))
+  if (GNUNET_OK !=
+      GNUNET_DISK_file_copy (HOSTKEY_FILE,
+                             keyfile))
   {
     GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
-        "Could not copy hostkey `%s' to destination `%s'.  Exiting.\n",
-        HOSTKEY_FILE, keyfile);
+               "Could not copy hostkey `%s' to destination `%s'.  Exiting.\n",
+               HOSTKEY_FILE,
+               keyfile);
     GNUNET_free(keyfile);
     end_badly_now ();
     return;
index 37d6895769c9d93d827f07d8bdee3c9a470d83b0..9e542a91cc1498a908ee5597828c56ba4827f17b 100644 (file)
@@ -1401,13 +1401,28 @@ GNUNET_DISK_file_copy (const char *src,
   struct GNUNET_DISK_FileHandle *in;
   struct GNUNET_DISK_FileHandle *out;
 
-  if (GNUNET_OK != GNUNET_DISK_file_size (src, &size, GNUNET_YES, GNUNET_YES))
+  if (GNUNET_OK !=
+      GNUNET_DISK_file_size (src,
+                             &size,
+                             GNUNET_YES,
+                             GNUNET_YES))
+  {
+    GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
+                              "stat",
+                              src);
     return GNUNET_SYSERR;
+  }
   pos = 0;
-  in = GNUNET_DISK_file_open (src, GNUNET_DISK_OPEN_READ,
+  in = GNUNET_DISK_file_open (src,
+                              GNUNET_DISK_OPEN_READ,
                               GNUNET_DISK_PERM_NONE);
-  if (!in)
+  if (! in)
+  {
+    GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
+                              "open",
+                              src);
     return GNUNET_SYSERR;
+  }
   out =
       GNUNET_DISK_file_open (dst,
                              GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE |
@@ -1418,6 +1433,9 @@ GNUNET_DISK_file_copy (const char *src,
                              GNUNET_DISK_PERM_GROUP_WRITE);
   if (!out)
   {
+    GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
+                              "open",
+                              dst);
     GNUNET_DISK_file_close (in);
     return GNUNET_SYSERR;
   }