]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
don't truncate the very first file opened (unless the truncate flag is there too)
authorEric Covener <covener@apache.org>
Fri, 7 Jun 2013 18:12:17 +0000 (18:12 +0000)
committerEric Covener <covener@apache.org>
Fri, 7 Jun 2013 18:12:17 +0000 (18:12 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1490761 13f79535-47bb-0310-9956-ffa450edef68

support/rotatelogs.c

index 52a59e030d5925d5786eb5064f0d6b10806dca8b..cf1eac1ea8076cb5d821a06f90c5334c1fcbb3cd 100644 (file)
@@ -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. */