diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-06-01 17:08:49 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-06-01 17:08:49 +0000 |
commit | 1ac9ef013b0e9c737d6909ab41a38b45a3d36e43 (patch) | |
tree | a989b4b6a8dc71c9352a7f5c6265ccf764260970 /src/util/common_logging.c | |
parent | 1be4eb49815a40fd5de052b2f7ceef7b99c4e08d (diff) | |
download | gnunet-1ac9ef013b0e9c737d6909ab41a38b45a3d36e43.tar.gz gnunet-1ac9ef013b0e9c737d6909ab41a38b45a3d36e43.zip |
fix #4545: create directory for log file if it does not exist
Diffstat (limited to 'src/util/common_logging.c')
-rw-r--r-- | src/util/common_logging.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/util/common_logging.c b/src/util/common_logging.c index 0cefa194d..4d78f4898 100644 --- a/src/util/common_logging.c +++ b/src/util/common_logging.c | |||
@@ -25,6 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_crypto_lib.h" | 27 | #include "gnunet_crypto_lib.h" |
28 | #include "gnunet_disk_lib.h" | ||
28 | #include "gnunet_strings_lib.h" | 29 | #include "gnunet_strings_lib.h" |
29 | #include <regex.h> | 30 | #include <regex.h> |
30 | 31 | ||
@@ -357,6 +358,15 @@ setup_log_file (const struct tm *tm) | |||
357 | return GNUNET_OK; /* no change */ | 358 | return GNUNET_OK; /* no change */ |
358 | log_rotate (last_fn); | 359 | log_rotate (last_fn); |
359 | strcpy (last_fn, fn); | 360 | strcpy (last_fn, fn); |
361 | if (GNUNET_SYSERR == | ||
362 | GNUNET_DISK_directory_create_for_file (fn)) | ||
363 | { | ||
364 | fprintf (stderr, | ||
365 | "Failed to create directory for `%s': %s\n", | ||
366 | fn, | ||
367 | STRERROR (errno)); | ||
368 | return GNUNET_SYSERR; | ||
369 | } | ||
360 | #if WINDOWS | 370 | #if WINDOWS |
361 | altlog_fd = OPEN (fn, O_APPEND | | 371 | altlog_fd = OPEN (fn, O_APPEND | |
362 | O_BINARY | | 372 | O_BINARY | |