diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-05-10 13:37:02 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-05-10 13:37:02 +0200 |
commit | 5351d6b088a895b5c21577ec540f139f2d6d2467 (patch) | |
tree | e1491f3ed6eb49d3acd555952b14517b4322db33 /src | |
parent | fa126996254a79c1140683ab32498ff07840b99e (diff) | |
download | gnunet-5351d6b088a895b5c21577ec540f139f2d6d2467.tar.gz gnunet-5351d6b088a895b5c21577ec540f139f2d6d2467.zip |
more verbose logging
Diffstat (limited to 'src')
-rw-r--r-- | src/transport/test_plugin_transport.c | 33 | ||||
-rw-r--r-- | src/util/disk.c | 24 |
2 files changed, 42 insertions, 15 deletions
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, | |||
566 | * @param c configuration to use | 566 | * @param c configuration to use |
567 | */ | 567 | */ |
568 | static void | 568 | static void |
569 | run (void *cls, char * const *args, const char *cfgfile, | 569 | run (void *cls, |
570 | const struct GNUNET_CONFIGURATION_Handle *c) | 570 | char * const *args, |
571 | const char *cfgfile, | ||
572 | const struct GNUNET_CONFIGURATION_Handle *c) | ||
571 | { | 573 | { |
572 | char * const *argv = cls; | 574 | char * const *argv = cls; |
573 | unsigned long long tneigh; | 575 | unsigned long long tneigh; |
@@ -575,8 +577,9 @@ run (void *cls, char * const *args, const char *cfgfile, | |||
575 | char *plugin; | 577 | char *plugin; |
576 | char *sep; | 578 | char *sep; |
577 | 579 | ||
578 | timeout_endbadly = GNUNET_SCHEDULER_add_delayed (TIMEOUT, end_badly, &ok); | 580 | timeout_endbadly = GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
579 | 581 | &end_badly, | |
582 | &ok); | ||
580 | cfg = c; | 583 | cfg = c; |
581 | /* parse configuration */ | 584 | /* parse configuration */ |
582 | if ((GNUNET_OK | 585 | if ((GNUNET_OK |
@@ -594,7 +597,7 @@ run (void *cls, char * const *args, const char *cfgfile, | |||
594 | if (NULL == (stats = GNUNET_STATISTICS_create ("transport", cfg))) | 597 | if (NULL == (stats = GNUNET_STATISTICS_create ("transport", cfg))) |
595 | { | 598 | { |
596 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 599 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
597 | "Could not create statistics. Exiting.\n"); | 600 | "Could not create statistics. Exiting.\n"); |
598 | GNUNET_free(keyfile); | 601 | GNUNET_free(keyfile); |
599 | end_badly_now (); | 602 | end_badly_now (); |
600 | return; | 603 | return; |
@@ -602,27 +605,33 @@ run (void *cls, char * const *args, const char *cfgfile, | |||
602 | 605 | ||
603 | if (GNUNET_OK != GNUNET_DISK_file_test (HOSTKEY_FILE)) | 606 | if (GNUNET_OK != GNUNET_DISK_file_test (HOSTKEY_FILE)) |
604 | { | 607 | { |
605 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Hostkey `%s' missing. Exiting.\n", | 608 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
606 | HOSTKEY_FILE); | 609 | "Hostkey `%s' missing. Exiting.\n", |
610 | HOSTKEY_FILE); | ||
607 | GNUNET_free(keyfile); | 611 | GNUNET_free(keyfile); |
608 | end_badly_now (); | 612 | end_badly_now (); |
609 | return; | 613 | return; |
610 | } | 614 | } |
611 | 615 | ||
612 | if (GNUNET_OK != GNUNET_DISK_directory_create_for_file (keyfile)) | 616 | if (GNUNET_OK != |
617 | GNUNET_DISK_directory_create_for_file (keyfile)) | ||
613 | { | 618 | { |
614 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 619 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
615 | "Could not create a directory for hostkey `%s'. Exiting.\n", keyfile); | 620 | "Could not create a directory for hostkey `%s'. Exiting.\n", |
621 | keyfile); | ||
616 | GNUNET_free(keyfile); | 622 | GNUNET_free(keyfile); |
617 | end_badly_now (); | 623 | end_badly_now (); |
618 | return; | 624 | return; |
619 | } | 625 | } |
620 | 626 | ||
621 | if (GNUNET_OK != GNUNET_DISK_file_copy (HOSTKEY_FILE, keyfile)) | 627 | if (GNUNET_OK != |
628 | GNUNET_DISK_file_copy (HOSTKEY_FILE, | ||
629 | keyfile)) | ||
622 | { | 630 | { |
623 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 631 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
624 | "Could not copy hostkey `%s' to destination `%s'. Exiting.\n", | 632 | "Could not copy hostkey `%s' to destination `%s'. Exiting.\n", |
625 | HOSTKEY_FILE, keyfile); | 633 | HOSTKEY_FILE, |
634 | keyfile); | ||
626 | GNUNET_free(keyfile); | 635 | GNUNET_free(keyfile); |
627 | end_badly_now (); | 636 | end_badly_now (); |
628 | return; | 637 | 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, | |||
1401 | struct GNUNET_DISK_FileHandle *in; | 1401 | struct GNUNET_DISK_FileHandle *in; |
1402 | struct GNUNET_DISK_FileHandle *out; | 1402 | struct GNUNET_DISK_FileHandle *out; |
1403 | 1403 | ||
1404 | if (GNUNET_OK != GNUNET_DISK_file_size (src, &size, GNUNET_YES, GNUNET_YES)) | 1404 | if (GNUNET_OK != |
1405 | GNUNET_DISK_file_size (src, | ||
1406 | &size, | ||
1407 | GNUNET_YES, | ||
1408 | GNUNET_YES)) | ||
1409 | { | ||
1410 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, | ||
1411 | "stat", | ||
1412 | src); | ||
1405 | return GNUNET_SYSERR; | 1413 | return GNUNET_SYSERR; |
1414 | } | ||
1406 | pos = 0; | 1415 | pos = 0; |
1407 | in = GNUNET_DISK_file_open (src, GNUNET_DISK_OPEN_READ, | 1416 | in = GNUNET_DISK_file_open (src, |
1417 | GNUNET_DISK_OPEN_READ, | ||
1408 | GNUNET_DISK_PERM_NONE); | 1418 | GNUNET_DISK_PERM_NONE); |
1409 | if (!in) | 1419 | if (! in) |
1420 | { | ||
1421 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, | ||
1422 | "open", | ||
1423 | src); | ||
1410 | return GNUNET_SYSERR; | 1424 | return GNUNET_SYSERR; |
1425 | } | ||
1411 | out = | 1426 | out = |
1412 | GNUNET_DISK_file_open (dst, | 1427 | GNUNET_DISK_file_open (dst, |
1413 | GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE | | 1428 | GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE | |
@@ -1418,6 +1433,9 @@ GNUNET_DISK_file_copy (const char *src, | |||
1418 | GNUNET_DISK_PERM_GROUP_WRITE); | 1433 | GNUNET_DISK_PERM_GROUP_WRITE); |
1419 | if (!out) | 1434 | if (!out) |
1420 | { | 1435 | { |
1436 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, | ||
1437 | "open", | ||
1438 | dst); | ||
1421 | GNUNET_DISK_file_close (in); | 1439 | GNUNET_DISK_file_close (in); |
1422 | return GNUNET_SYSERR; | 1440 | return GNUNET_SYSERR; |
1423 | } | 1441 | } |