logrotate/logrotate-fail_if_ENOENT_and_nomissingok.patch
Cristian Rodríguez b7eabb9739 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
2014-04-03 00:23:52 +00:00

16 lines
725 B
Diff

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);