From: Christian Grothoff Date: Thu, 10 May 2018 11:37:02 +0000 (+0200) Subject: more verbose logging X-Git-Tag: v0.11.0pre66~59^2~22 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=5351d6b088a895b5c21577ec540f139f2d6d2467;p=oweals%2Fgnunet.git more verbose logging --- diff --git a/src/transport/test_plugin_transport.c b/src/transport/test_plugin_transport.c index acb3911f0..d80a13410 100644 --- a/src/transport/test_plugin_transport.c +++ b/src/transport/test_plugin_transport.c @@ -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; diff --git a/src/util/disk.c b/src/util/disk.c index 37d689576..9e542a91c 100644 --- a/src/util/disk.c +++ b/src/util/disk.c @@ -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; }