Projects
openEuler:24.03:SP1:Everything
logrotate
_service:tar_scm:backport-do-not-rotate-old-log...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:backport-do-not-rotate-old-logs-on-prerotate-failure.patch of Package logrotate
From 5f24239f282b8c6291cf35ea5f871ed0ca6b2672 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com> Date: Tue, 4 Apr 2023 17:49:06 +0200 Subject: [PATCH] do not rotate old logs on prerotate failure Ensures old logs are preserved and not rotated out for logs with a failing prerotate script. Alternative to #502 --- logrotate.c | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) diff --git a/logrotate.c b/logrotate.c index f44b3851..d3ccb447 100644 --- a/logrotate.c +++ b/logrotate.c @@ -2476,10 +2476,6 @@ static int rotateLogSet(const struct logInfo *log, int force) return 1; } memset(rotNames[i], 0, sizeof(struct logNames)); - - logHasErrors[i] |= - prerotateSingleLog(log, i, state[i], rotNames[i]); - hasErrors |= logHasErrors[i]; } if (log->pre @@ -2509,6 +2505,16 @@ static int rotateLogSet(const struct logInfo *log, int force) } } + for (i = j; + ((log->flags & LOG_FLAG_SHAREDSCRIPTS) && i < log->numFiles) + || (!(log->flags & LOG_FLAG_SHAREDSCRIPTS) && i == j); i++) { + if (! ( (logHasErrors[i] && !(log->flags & LOG_FLAG_SHAREDSCRIPTS)) + || (hasErrors && (log->flags & LOG_FLAG_SHAREDSCRIPTS)) ) ) { + logHasErrors[i] |= prerotateSingleLog(log, i, state[i], rotNames[i]); + hasErrors |= logHasErrors[i]; + } + } + for (i = j; ((log->flags & LOG_FLAG_SHAREDSCRIPTS) && i < log->numFiles) || (!(log->flags & LOG_FLAG_SHAREDSCRIPTS) && i == j); i++) {
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2