From c90ad5e257e99f3d382afc93596e7d75c65c2266 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20O=2E=20Sel=C3=A5sdal?= Date: Tue, 10 Feb 2015 21:46:08 +0100 Subject: [PATCH] There's no good reason to not always reset the file size after re-opening --- src/logging.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/logging.c b/src/logging.c index c235546..1301bc8 100644 --- a/src/logging.c +++ b/src/logging.c @@ -447,10 +447,12 @@ int uc_log_reopen_files(void) UC_TAILQ_FOREACH_CONTAINER(dest, entry, &g_destinations) { if (dest->dest_type == UC_LDEST_FILE) { - rc = uc_log_reopen_file(dest); - if (rc == 0) { - dest->type.file.size = 0; + int r_rc; + r_rc = uc_log_reopen_file(dest); + if (r_rc != 0) { + rc = r_rc; } + dest->type.file.size = 0; } } @@ -633,7 +635,6 @@ static void uc_log_file_rotate_size(struct UCLogDestination *dest) char new_filename[_POSIX_PATH_MAX * 2]; char old_filename[_POSIX_PATH_MAX * 2]; unsigned int i; - int rc; if (dest->type.file.file_name == NULL) { return; @@ -653,10 +654,8 @@ static void uc_log_file_rotate_size(struct UCLogDestination *dest) rename(dest->type.file.file_name, new_filename); //re-open current file - rc = uc_log_reopen_file(dest); - if (rc == 0) { - dest->type.file.size = 0; - } + uc_log_reopen_file(dest); + dest->type.file.size = 0; return; }