From b7eabb9739d4141642a5c8d6de768927c04fcd2f1cfcef5d7734fb5259b81d1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= Date: Thu, 3 Apr 2014 00:23:52 +0000 Subject: [PATCH] Accepting request 228751 from home:vitezslav_cizek:branches:Base:System - return error when nomissingok is specified and the log path doesn't exist (bnc#871217) * added logrotate-fail_if_ENOENT_and_nomissingok.patch OBS-URL: https://build.opensuse.org/request/show/228751 OBS-URL: https://build.opensuse.org/package/show/Base:System/logrotate?expand=0&rev=34 --- logrotate-fail_if_ENOENT_and_nomissingok.patch | 15 +++++++++++++++ logrotate.changes | 7 +++++++ logrotate.spec | 4 +++- 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 logrotate-fail_if_ENOENT_and_nomissingok.patch diff --git a/logrotate-fail_if_ENOENT_and_nomissingok.patch b/logrotate-fail_if_ENOENT_and_nomissingok.patch new file mode 100644 index 0000000..00d4c0f --- /dev/null +++ b/logrotate-fail_if_ENOENT_and_nomissingok.patch @@ -0,0 +1,15 @@ +Index: logrotate-3.8.7/logrotate.c +=================================================================== +--- logrotate-3.8.7.orig/logrotate.c 2014-04-01 18:39:14.294635014 +0200 ++++ logrotate-3.8.7/logrotate.c 2014-04-01 18:40:29.613496763 +0200 +@@ -795,8 +795,9 @@ int findNeedRotating(struct logInfo *log + char *ld = ourDirName(log->files[logNum]); + if (stat(ld, &sb)) { + /* If parent directory doesn't exist, it's not real error ++ (unless nomissingok is specified) + and rotation is not needed */ +- if (errno != ENOENT) { ++ if (errno != ENOENT || (errno == ENOENT && (log->flags & LOG_FLAG_MISSINGOK) == 0)) { + message(MESS_ERROR, "stat of %s failed: %s\n", ld, + strerror(errno)); + free(ld); diff --git a/logrotate.changes b/logrotate.changes index 6f3282a..cc1e20a 100644 --- a/logrotate.changes +++ b/logrotate.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Apr 1 15:11:22 UTC 2014 - vcizek@suse.com + +- return error when nomissingok is specified and the log path + doesn't exist (bnc#871217) + * added logrotate-fail_if_ENOENT_and_nomissingok.patch + ------------------------------------------------------------------- Thu Nov 7 21:57:31 UTC 2013 - sweet_f_a@gmx.de diff --git a/logrotate.spec b/logrotate.spec index b3cc8c0..e257577 100644 --- a/logrotate.spec +++ b/logrotate.spec @@ -1,7 +1,7 @@ # # spec file for package logrotate # -# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -32,6 +32,7 @@ Patch2: logrotate-3.7.8-autoext.patch Patch3: logrotate-3.7.8-addextension.patch Patch4: logrotate-3.7.8-mess_err.patch Patch5: logrotate-manpage_config_clarification.patch +Patch6: logrotate-fail_if_ENOENT_and_nomissingok.patch BuildRequires: acl BuildRequires: libacl-devel BuildRequires: libselinux-devel @@ -59,6 +60,7 @@ daily cron job. %patch3 %patch4 %patch5 -p1 +%patch6 -p1 %build make %{?_smp_mflags} CC="%__cc" RPM_OPT_FLAGS="%{optflags}" \