From: Eric Covener Date: Fri, 7 Jun 2013 18:12:17 +0000 (+0000) Subject: don't truncate the very first file opened (unless the truncate flag is there too) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cbec04137a78e84c63a668ce7665ffa56c3625fa;p=thirdparty%2Fapache%2Fhttpd.git 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 --- 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. */