From cbec04137a78e84c63a668ce7665ffa56c3625fa Mon Sep 17 00:00:00 2001 From: Eric Covener Date: Fri, 7 Jun 2013 18:12:17 +0000 Subject: [PATCH] don't truncate the very first file opened (unless the truncate flag is there too) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1490761 13f79535-47bb-0310-9956-ffa450edef68 --- support/rotatelogs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support/rotatelogs.c b/support/rotatelogs.c index 52a59e030d5..cf1eac1ea80 100644 --- a/support/rotatelogs.c +++ b/support/rotatelogs.c @@ -418,7 +418,7 @@ static void doRotate(rotate_config_t *config, rotate_status_t *status) fprintf(stderr, "Opening file %s\n", newlog.name); } rv = apr_file_open(&newlog.fd, newlog.name, APR_WRITE | APR_CREATE | APR_APPEND - | (config->truncate || (config->num_files > 0) ? APR_TRUNCATE : 0), + | (config->truncate || (config->num_files > 0 && status->current.fd) ? APR_TRUNCATE : 0), APR_OS_DEFAULT, newlog.pool); if (rv == APR_SUCCESS) { /* Handle post-rotate processing. */ -- 2.47.3