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; }