*** empty log message ***
This commit is contained in:
parent
ea89d9100d
commit
4f28f0f253
@ -1 +1 @@
|
|||||||
logrotate-3.7.8.tar.gz
|
logrotate-3.7.9.tar.gz
|
||||||
|
@ -1,40 +0,0 @@
|
|||||||
diff -up logrotate-3.7.6/logrotate.c.fdclose logrotate-3.7.6/logrotate.c
|
|
||||||
--- logrotate-3.7.6/logrotate.c.fdclose 2008-04-21 11:49:57.000000000 +0200
|
|
||||||
+++ logrotate-3.7.6/logrotate.c 2008-04-21 11:53:08.000000000 +0200
|
|
||||||
@@ -935,6 +935,9 @@ int rotateSingleLog(logInfo * log, int l
|
|
||||||
if (oldContext != NULL) {
|
|
||||||
freecon(oldContext);
|
|
||||||
}
|
|
||||||
+ if (close(fdcurr) < 0)
|
|
||||||
+ message(MESS_ERROR, "error closing file %s",
|
|
||||||
+ log->files[logNum]);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -946,6 +949,9 @@ int rotateSingleLog(logInfo * log, int l
|
|
||||||
if (oldContext != NULL) {
|
|
||||||
freecon(oldContext);
|
|
||||||
}
|
|
||||||
+ if (close(fdcurr) < 0)
|
|
||||||
+ message(MESS_ERROR, "error closing file %s",
|
|
||||||
+ log->files[logNum]);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -959,10 +965,16 @@ int rotateSingleLog(logInfo * log, int l
|
|
||||||
message(MESS_ERROR, "getting file context %s: %s\n",
|
|
||||||
log->files[logNum], strerror(errno));
|
|
||||||
if (selinux_enforce) {
|
|
||||||
+ if (close(fdcurr) < 0)
|
|
||||||
+ message(MESS_ERROR, "error closing file %s",
|
|
||||||
+ log->files[logNum]);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+ if (close(fdcurr) < 0)
|
|
||||||
+ message(MESS_ERROR, "error closing file %s",
|
|
||||||
+ log->files[logNum]);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
message(MESS_DEBUG, "renaming %s to %s\n", log->files[logNum],
|
|
@ -1,11 +0,0 @@
|
|||||||
diff -up logrotate-3.7.6/logrotate.c.segfault logrotate-3.7.6/logrotate.c
|
|
||||||
--- logrotate-3.7.6/logrotate.c.segfault 2008-04-23 14:40:51.000000000 +0200
|
|
||||||
+++ logrotate-3.7.6/logrotate.c 2008-04-23 14:41:14.000000000 +0200
|
|
||||||
@@ -1380,6 +1380,7 @@ static int readState(char *stateFilename
|
|
||||||
line++;
|
|
||||||
|
|
||||||
while (fgets(buf, sizeof(buf) - 1, f)) {
|
|
||||||
+ argv = NULL;
|
|
||||||
line++;
|
|
||||||
i = strlen(buf);
|
|
||||||
if (buf[i - 1] != '\n') {
|
|
@ -1,128 +0,0 @@
|
|||||||
diff -up logrotate-3.7.6/logrotate.c.selinux logrotate-3.7.6/logrotate.c
|
|
||||||
--- logrotate-3.7.6/logrotate.c.selinux 2007-08-07 09:14:35.000000000 +0200
|
|
||||||
+++ logrotate-3.7.6/logrotate.c 2008-01-21 09:32:56.000000000 +0100
|
|
||||||
@@ -409,15 +409,17 @@ static int copyTruncate(char *currLog, c
|
|
||||||
}
|
|
||||||
#ifdef WITH_SELINUX
|
|
||||||
if (selinux_enabled) {
|
|
||||||
- security_context_t oldContext;
|
|
||||||
+ security_context_t oldContext = NULL;
|
|
||||||
if (fgetfilecon_raw(fdcurr, &oldContext) >= 0) {
|
|
||||||
if (getfscreatecon_raw(&prev_context) < 0) {
|
|
||||||
message(MESS_ERROR,
|
|
||||||
"getting default context: %s\n",
|
|
||||||
strerror(errno));
|
|
||||||
if (selinux_enforce) {
|
|
||||||
- freecon(oldContext);
|
|
||||||
- return 1;
|
|
||||||
+ if (oldContext != NULL) {
|
|
||||||
+ freecon(oldContext);
|
|
||||||
+ }
|
|
||||||
+ return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (setfscreatecon_raw(oldContext) < 0) {
|
|
||||||
@@ -425,11 +427,15 @@ static int copyTruncate(char *currLog, c
|
|
||||||
"setting file context %s to %s: %s\n",
|
|
||||||
saveLog, oldContext, strerror(errno));
|
|
||||||
if (selinux_enforce) {
|
|
||||||
- freecon(oldContext);
|
|
||||||
- return 1;
|
|
||||||
+ if (oldContext != NULL) {
|
|
||||||
+ freecon(oldContext);
|
|
||||||
+ }
|
|
||||||
+ return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
- freecon(oldContext);
|
|
||||||
+ if (oldContext != NULL) {
|
|
||||||
+ freecon(oldContext);
|
|
||||||
+ }
|
|
||||||
} else {
|
|
||||||
if (errno != ENOTSUP) {
|
|
||||||
message(MESS_ERROR, "getting file context %s: %s\n",
|
|
||||||
@@ -899,6 +905,9 @@ int rotateSingleLog(logInfo * log, int l
|
|
||||||
int hasErrors = 0;
|
|
||||||
struct stat sb;
|
|
||||||
int fd;
|
|
||||||
+#ifdef WITH_SELINUX
|
|
||||||
+ security_context_t savedContext = NULL;
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
if (!state->doRotate)
|
|
||||||
return 0;
|
|
||||||
@@ -906,7 +915,57 @@ int rotateSingleLog(logInfo * log, int l
|
|
||||||
if (!hasErrors) {
|
|
||||||
|
|
||||||
if (!(log->flags & (LOG_FLAG_COPYTRUNCATE | LOG_FLAG_COPY))) {
|
|
||||||
- message(MESS_DEBUG, "renaming %s to %s\n", log->files[logNum],
|
|
||||||
+#ifdef WITH_SELINUX
|
|
||||||
+ if (selinux_enabled) {
|
|
||||||
+ security_context_t oldContext = NULL;
|
|
||||||
+ int fdcurr = -1;
|
|
||||||
+
|
|
||||||
+ if ((fdcurr = open(log->files[logNum], O_RDWR)) < 0) {
|
|
||||||
+ message(MESS_ERROR, "error opening %s: %s\n",
|
|
||||||
+ log->files[logNum],
|
|
||||||
+ strerror(errno));
|
|
||||||
+ return 1;
|
|
||||||
+ }
|
|
||||||
+ if (fgetfilecon_raw(fdcurr, &oldContext) >= 0) {
|
|
||||||
+ if (getfscreatecon_raw(&savedContext) < 0) {
|
|
||||||
+ message(MESS_ERROR,
|
|
||||||
+ "getting default context: %s\n",
|
|
||||||
+ strerror(errno));
|
|
||||||
+ if (selinux_enforce) {
|
|
||||||
+ if (oldContext != NULL) {
|
|
||||||
+ freecon(oldContext);
|
|
||||||
+ }
|
|
||||||
+ return 1;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ if (setfscreatecon_raw(oldContext) < 0) {
|
|
||||||
+ message(MESS_ERROR,
|
|
||||||
+ "setting file context %s to %s: %s\n",
|
|
||||||
+ log->files[logNum], oldContext, strerror(errno));
|
|
||||||
+ if (selinux_enforce) {
|
|
||||||
+ if (oldContext != NULL) {
|
|
||||||
+ freecon(oldContext);
|
|
||||||
+ }
|
|
||||||
+ return 1;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ message(MESS_DEBUG, "fscreate context set to %s\n",
|
|
||||||
+ oldContext);
|
|
||||||
+ if (oldContext != NULL) {
|
|
||||||
+ freecon(oldContext);
|
|
||||||
+ }
|
|
||||||
+ } else {
|
|
||||||
+ if (errno != ENOTSUP) {
|
|
||||||
+ message(MESS_ERROR, "getting file context %s: %s\n",
|
|
||||||
+ log->files[logNum], strerror(errno));
|
|
||||||
+ if (selinux_enforce) {
|
|
||||||
+ return 1;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+#endif
|
|
||||||
+ message(MESS_DEBUG, "renaming %s to %s\n", log->files[logNum],
|
|
||||||
rotNames->finalName);
|
|
||||||
|
|
||||||
if (!debug && !hasErrors &&
|
|
||||||
@@ -961,6 +1020,15 @@ int rotateSingleLog(logInfo * log, int l
|
|
||||||
close(fd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+#ifdef WITH_SELINUX
|
|
||||||
+ if (selinux_enabled) {
|
|
||||||
+ setfscreatecon_raw(savedContext);
|
|
||||||
+ if (savedContext != NULL) {
|
|
||||||
+ freecon(savedContext);
|
|
||||||
+ savedContext = NULL;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
if (!hasErrors
|
|
||||||
&& log->flags & (LOG_FLAG_COPYTRUNCATE | LOG_FLAG_COPY))
|
|
@ -1,71 +0,0 @@
|
|||||||
diff -up logrotate-3.7.7/config.c.curdir logrotate-3.7.7/config.c
|
|
||||||
--- logrotate-3.7.7/config.c.curdir 2008-11-20 14:50:29.000000000 +0100
|
|
||||||
+++ logrotate-3.7.7/config.c 2008-11-20 14:51:35.000000000 +0100
|
|
||||||
@@ -301,7 +301,7 @@ static void freeTailLogs(int num)
|
|
||||||
static int readConfigPath(const char *path, struct logInfo *defConfig)
|
|
||||||
{
|
|
||||||
struct stat sb;
|
|
||||||
- int here, oldnumlogs, result = 1;
|
|
||||||
+ int oldnumlogs, result = 1;
|
|
||||||
struct logInfo defConfigBackup;
|
|
||||||
|
|
||||||
if (stat(path, &sb)) {
|
|
||||||
@@ -315,17 +315,10 @@ static int readConfigPath(const char *pa
|
|
||||||
int files_count, i;
|
|
||||||
DIR *dirp;
|
|
||||||
|
|
||||||
- here = open(".", O_RDONLY);
|
|
||||||
- if (here < 0) {
|
|
||||||
- message(MESS_ERROR, "cannot open current directory: %s\n",
|
|
||||||
- strerror(errno));
|
|
||||||
- return 1;
|
|
||||||
- }
|
|
||||||
|
|
||||||
if ((dirp = opendir(path)) == NULL) {
|
|
||||||
message(MESS_ERROR, "cannot open directory %s: %s\n", path,
|
|
||||||
strerror(errno));
|
|
||||||
- close(here);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
files_count = 0;
|
|
||||||
@@ -344,7 +337,6 @@ static int readConfigPath(const char *pa
|
|
||||||
} else {
|
|
||||||
free_2d_array(namelist, files_count);
|
|
||||||
closedir(dirp);
|
|
||||||
- close(here);
|
|
||||||
message(MESS_ERROR, "cannot realloc: %s\n",
|
|
||||||
strerror(errno));
|
|
||||||
return 1;
|
|
||||||
@@ -358,7 +350,6 @@ static int readConfigPath(const char *pa
|
|
||||||
} else {
|
|
||||||
free_2d_array(namelist, files_count);
|
|
||||||
closedir(dirp);
|
|
||||||
- close(here);
|
|
||||||
message(MESS_ERROR, "cannot realloc: %s\n",
|
|
||||||
strerror(errno));
|
|
||||||
return 1;
|
|
||||||
@@ -370,14 +361,12 @@ static int readConfigPath(const char *pa
|
|
||||||
if (files_count > 0) {
|
|
||||||
qsort(namelist, files_count, sizeof(char *), compar);
|
|
||||||
} else {
|
|
||||||
- close(here);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (chdir(path)) {
|
|
||||||
message(MESS_ERROR, "error in chdir(\"%s\"): %s\n", path,
|
|
||||||
strerror(errno));
|
|
||||||
- close(here);
|
|
||||||
free_2d_array(namelist, files_count);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
@@ -399,8 +388,7 @@ static int readConfigPath(const char *pa
|
|
||||||
freeLogInfo(&defConfigBackup);
|
|
||||||
}
|
|
||||||
|
|
||||||
- fchdir(here);
|
|
||||||
- close(here);
|
|
||||||
+ chdir(".");
|
|
||||||
free_2d_array(namelist, files_count);
|
|
||||||
} else {
|
|
||||||
oldnumlogs = numLogs;
|
|
@ -1,15 +0,0 @@
|
|||||||
diff -up logrotate-3.7.7/config.c.curdir logrotate-3.7.7/config.c
|
|
||||||
--- logrotate-3.7.7/config.c.curdir 2008-05-09 09:28:59.000000000 +0200
|
|
||||||
+++ logrotate-3.7.7/config.c 2008-11-20 15:35:05.000000000 +0100
|
|
||||||
@@ -316,11 +316,6 @@ static int readConfigPath(const char *pa
|
|
||||||
DIR *dirp;
|
|
||||||
|
|
||||||
here = open(".", O_RDONLY);
|
|
||||||
- if (here < 0) {
|
|
||||||
- message(MESS_ERROR, "cannot open current directory: %s\n",
|
|
||||||
- strerror(errno));
|
|
||||||
- return 1;
|
|
||||||
- }
|
|
||||||
|
|
||||||
if ((dirp = opendir(path)) == NULL) {
|
|
||||||
message(MESS_ERROR, "cannot open directory %s: %s\n", path,
|
|
@ -1,17 +0,0 @@
|
|||||||
diff -up logrotate-3.7.7/config.c.toolarge logrotate-3.7.7/config.c
|
|
||||||
--- logrotate-3.7.7/config.c.toolarge 2008-11-21 12:57:25.000000000 +0100
|
|
||||||
+++ logrotate-3.7.7/config.c 2008-11-21 12:57:41.000000000 +0100
|
|
||||||
@@ -530,6 +530,13 @@ static int readConfigFile(const char *co
|
|
||||||
|
|
||||||
length = sb.st_size;
|
|
||||||
|
|
||||||
+ if (length > 0xffffff) {
|
|
||||||
+ message(MESS_ERROR, "file %s too large, probably not a config file.\n",
|
|
||||||
+ configFile);
|
|
||||||
+ close(fd);
|
|
||||||
+ return 1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
buf = alloca(length + 2);
|
|
||||||
if (!buf) {
|
|
||||||
message(MESS_ERROR, "alloca() of %d bytes failed\n", (int) length);
|
|
@ -1,42 +0,0 @@
|
|||||||
Index: /trunk/logrotate.c
|
|
||||||
===================================================================
|
|
||||||
--- /trunk/logrotate.c (revision 273)
|
|
||||||
+++ /trunk/logrotate.c (revision 276)
|
|
||||||
@@ -1199,5 +1199,5 @@
|
|
||||||
switch (log->criterium) {
|
|
||||||
case ROT_DAYS:
|
|
||||||
- message(MESS_DEBUG, "after %d days ", log->threshhold);
|
|
||||||
+ message(MESS_DEBUG, "after %llu days ", log->threshhold);
|
|
||||||
break;
|
|
||||||
case ROT_WEEKLY:
|
|
||||||
@@ -1211,5 +1211,5 @@
|
|
||||||
break;
|
|
||||||
case ROT_SIZE:
|
|
||||||
- message(MESS_DEBUG, "%d bytes ", log->threshhold);
|
|
||||||
+ message(MESS_DEBUG, "%llu bytes ", log->threshhold);
|
|
||||||
break;
|
|
||||||
case ROT_FORCE:
|
|
||||||
Index: /trunk/logrotate.h
|
|
||||||
===================================================================
|
|
||||||
--- /trunk/logrotate.h (revision 248)
|
|
||||||
+++ /trunk/logrotate.h (revision 276)
|
|
||||||
@@ -34,6 +34,6 @@
|
|
||||||
enum { ROT_DAYS, ROT_WEEKLY, ROT_MONTHLY, ROT_YEARLY, ROT_SIZE,
|
|
||||||
ROT_FORCE } criterium;
|
|
||||||
- unsigned int threshhold;
|
|
||||||
- unsigned int minsize;
|
|
||||||
+ unsigned long long threshhold;
|
|
||||||
+ unsigned long long minsize;
|
|
||||||
int rotateCount;
|
|
||||||
int rotateAge;
|
|
||||||
Index: /trunk/config.c
|
|
||||||
===================================================================
|
|
||||||
--- /trunk/config.c (revision 274)
|
|
||||||
+++ /trunk/config.c (revision 276)
|
|
||||||
@@ -794,5 +794,5 @@
|
|
||||||
*endtag = oldchar, start = endtag;
|
|
||||||
} else if (!strcmp(start, "size") || !strcmp(start, "minsize")) {
|
|
||||||
- unsigned int size = 0;
|
|
||||||
+ unsigned long long size = 0;
|
|
||||||
char *opt = start;
|
|
||||||
*endtag = oldchar, start = endtag;
|
|
@ -1,11 +0,0 @@
|
|||||||
diff -up logrotate-3.7.8/examples/logrotate.cron.devnull logrotate-3.7.8/examples/logrotate.cron
|
|
||||||
--- logrotate-3.7.8/examples/logrotate.cron.devnull 2009-09-17 11:29:19.000000000 +0200
|
|
||||||
+++ logrotate-3.7.8/examples/logrotate.cron 2009-09-17 11:29:40.000000000 +0200
|
|
||||||
@@ -1,6 +1,6 @@
|
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
-/usr/sbin/logrotate /etc/logrotate.conf
|
|
||||||
+/usr/sbin/logrotate /etc/logrotate.conf >/dev/null 2>&1
|
|
||||||
EXITVALUE=$?
|
|
||||||
if [ $EXITVALUE != 0 ]; then
|
|
||||||
/usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
|
|
@ -1,16 +0,0 @@
|
|||||||
Index: logrotate.c
|
|
||||||
===================================================================
|
|
||||||
--- logrotate.c (revision 276)
|
|
||||||
+++ logrotate.c (working copy)
|
|
||||||
@@ -848,9 +848,10 @@
|
|
||||||
mailLogWrapper(mailFilename,
|
|
||||||
mailCommand, logNum,
|
|
||||||
log);
|
|
||||||
- if (!hasErrors)
|
|
||||||
+ if (!hasErrors) {
|
|
||||||
message(MESS_DEBUG, "removing %s\n", mailFilename);
|
|
||||||
hasErrors = removeLogFile(mailFilename, log);
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
mail_out = i;
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
diff -up /dev/null logrotate-3.7.8/logrotate.conf.5
|
|
||||||
--- /dev/null 2009-09-29 13:43:00.063127317 +0200
|
|
||||||
+++ logrotate-3.7.8/logrotate.conf.5 2009-09-29 14:46:24.000000000 +0200
|
|
||||||
@@ -0,0 +1 @@
|
|
||||||
+.so man8/logrotate.8
|
|
||||||
diff -up logrotate-3.7.8/Makefile.man5 logrotate-3.7.8/Makefile
|
|
||||||
--- logrotate-3.7.8/Makefile.man5 2008-05-19 12:25:54.000000000 +0200
|
|
||||||
+++ logrotate-3.7.8/Makefile 2009-09-29 14:47:01.000000000 +0200
|
|
||||||
@@ -3,7 +3,8 @@ OS_NAME = $(shell uname -s)
|
|
||||||
LFS = $(shell echo `getconf LFS_CFLAGS 2>/dev/null`)
|
|
||||||
CFLAGS = -Wall -D_GNU_SOURCE -D$(OS_NAME) -DVERSION=\"$(VERSION)\" $(RPM_OPT_FLAGS) $(LFS)
|
|
||||||
PROG = logrotate
|
|
||||||
-MAN = logrotate.8
|
|
||||||
+MAN = logrotate.8
|
|
||||||
+MAN5 = logrotate.conf.5
|
|
||||||
LOADLIBES = -lpopt
|
|
||||||
SVNURL= svn+ssh://svn.fedorahosted.org/svn/logrotate
|
|
||||||
SVNPUBURL = http://svn.fedorahosted.org/svn/logrotate
|
|
||||||
@@ -99,6 +100,7 @@ install:
|
|
||||||
[ -d $(PREFIX)/$(BINDIR) ] || mkdir -p $(PREFIX)/$(BINDIR)
|
|
||||||
[ -d $(PREFIX)/$(MANDIR) ] || mkdir -p $(PREFIX)/$(MANDIR)
|
|
||||||
[ -d $(PREFIX)/$(MANDIR)/man8 ] || mkdir -p $(PREFIX)/$(MANDIR)/man8
|
|
||||||
+ [ -d $(PREFIX)/$(MANDIR)/man5 ] || mkdir -p $(PREFIX)/$(MANDIR)/man5
|
|
||||||
|
|
||||||
if [ "$(OS_NAME)" = HP-UX ]; then \
|
|
||||||
$(INSTALL) $(PROG) $(PREFIX)/$(BINDIR) 0755 bin bin; \
|
|
||||||
@@ -106,6 +108,7 @@ install:
|
|
||||||
else \
|
|
||||||
$(INSTALL) -m 755 $(PROG) $(PREFIX)/$(BINDIR); \
|
|
||||||
$(INSTALL) -m 644 $(MAN) $(PREFIX)/$(MANDIR)/man`echo $(MAN) | sed "s/.*\.//"`/$(MAN); \
|
|
||||||
+ $(INSTALL) -m 644 $(MAN5) $(PREFIX)/$(MANDIR)/man`echo $(MAN5) | sed "s/.*\.//"`/$(MAN5); \
|
|
||||||
fi
|
|
||||||
|
|
||||||
co:
|
|
@ -1,74 +0,0 @@
|
|||||||
diff -up logrotate-3.7.8/config.c.missingok logrotate-3.7.8/config.c
|
|
||||||
--- logrotate-3.7.8/config.c.missingok 2010-04-06 11:35:11.000000000 +0200
|
|
||||||
+++ logrotate-3.7.8/config.c 2010-04-06 11:43:37.000000000 +0200
|
|
||||||
@@ -41,6 +41,7 @@ static int defTabooCount = sizeof(defTab
|
|
||||||
/* I shouldn't use globals here :-( */
|
|
||||||
static char **tabooExts = NULL;
|
|
||||||
int tabooCount = 0;
|
|
||||||
+static int glob_errno = 0;
|
|
||||||
|
|
||||||
static int readConfigFile(const char *configFile, struct logInfo *defConfig);
|
|
||||||
static int globerr(const char *pathname, int theerr);
|
|
||||||
@@ -461,8 +462,7 @@ int readAllConfigPaths(const char **path
|
|
||||||
|
|
||||||
static int globerr(const char *pathname, int theerr)
|
|
||||||
{
|
|
||||||
- message(MESS_ERROR, "error accessing %s: %s\n", pathname,
|
|
||||||
- strerror(theerr));
|
|
||||||
+ glob_errno = theerr;
|
|
||||||
|
|
||||||
/* We want the glob operation to abort on error, so return 1 */
|
|
||||||
return 1;
|
|
||||||
@@ -501,6 +501,7 @@ static int readConfigFile(const char *co
|
|
||||||
int logerror = 0;
|
|
||||||
struct logInfo *log;
|
|
||||||
static unsigned recursion_depth = 0U;
|
|
||||||
+ char *globerr_msg = NULL;
|
|
||||||
|
|
||||||
/* FIXME: createOwner and createGroup probably shouldn't be fixed
|
|
||||||
length arrays -- of course, if we aren't run setuid it doesn't
|
|
||||||
@@ -1346,16 +1347,25 @@ static int readConfigFile(const char *co
|
|
||||||
newlog->files = NULL;
|
|
||||||
newlog->numFiles = 0;
|
|
||||||
for (argNum = 0; argNum < argc && logerror != 1; argNum++) {
|
|
||||||
+ if (globerr_msg) {
|
|
||||||
+ free(globerr_msg);
|
|
||||||
+ globerr_msg = NULL;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
rc = glob(argv[argNum], GLOB_NOCHECK, globerr,
|
|
||||||
&globResult);
|
|
||||||
if (rc == GLOB_ABORTED) {
|
|
||||||
if (newlog->flags & LOG_FLAG_MISSINGOK)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
- message(MESS_ERROR, "%s:%d glob failed for %s\n",
|
|
||||||
- configFile, lineNum, argv[argNum]);
|
|
||||||
- logerror = 1;
|
|
||||||
- break;
|
|
||||||
+ /* We don't yet know whether this stanza has "missingok"
|
|
||||||
+ * set, so store the error message for later. */
|
|
||||||
+ rc = asprintf(&globerr_msg, "%s:%d glob failed for %s: %s\n",
|
|
||||||
+ configFile, lineNum, argv[argNum], strerror(glob_errno));
|
|
||||||
+ if (rc == -1)
|
|
||||||
+ globerr_msg = NULL;
|
|
||||||
+
|
|
||||||
+ globResult.gl_pathc = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
newlog->files =
|
|
||||||
@@ -1407,6 +1417,14 @@ duperror:
|
|
||||||
lineNum);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
+ if (globerr_msg) {
|
|
||||||
+ if (!(newlog->flags & LOG_FLAG_MISSINGOK))
|
|
||||||
+ message(MESS_ERROR, globerr_msg);
|
|
||||||
+ free(globerr_msg);
|
|
||||||
+ globerr_msg = NULL;
|
|
||||||
+ if (!(newlog->flags & LOG_FLAG_MISSINGOK))
|
|
||||||
+ return 1;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
if (newlog->oldDir) {
|
|
||||||
for (i = 0; i < newlog->numFiles; i++) {
|
|
@ -1,12 +0,0 @@
|
|||||||
diff -up logrotate-3.7.8/examples/logrotate-default.perm logrotate-3.7.8/examples/logrotate-default
|
|
||||||
--- logrotate-3.7.8/examples/logrotate-default.perm 2010-01-11 13:48:15.000000000 +0100
|
|
||||||
+++ logrotate-3.7.8/examples/logrotate-default 2010-01-11 13:48:46.000000000 +0100
|
|
||||||
@@ -6,7 +6,7 @@ weekly
|
|
||||||
rotate 4
|
|
||||||
|
|
||||||
# create new (empty) log files after rotating old ones
|
|
||||||
-create
|
|
||||||
+create 0640 root adm
|
|
||||||
|
|
||||||
# use date as a suffix of the rotated file
|
|
||||||
dateext
|
|
@ -1,11 +0,0 @@
|
|||||||
--- logrotate-3.7.8/logrotate.c.readonly 2009-12-09 09:09:10.000000000 -0800
|
|
||||||
+++ logrotate-3.7.8/logrotate.c 2009-12-09 09:21:37.000000000 -0800
|
|
||||||
@@ -432,7 +432,7 @@ static int copyTruncate(char *currLog, c
|
|
||||||
message(MESS_DEBUG, "copying %s to %s\n", currLog, saveLog);
|
|
||||||
|
|
||||||
if (!debug) {
|
|
||||||
- if ((fdcurr = open(currLog, O_RDWR)) < 0) {
|
|
||||||
+ if ((fdcurr = open(currLog, (flags & LOG_FLAG_COPY) ? O_RDONLY : O_RDWR)) < 0) {
|
|
||||||
message(MESS_ERROR, "error opening %s: %s\n", currLog,
|
|
||||||
strerror(errno));
|
|
||||||
return 1;
|
|
@ -1,22 +0,0 @@
|
|||||||
Index: logrotate.c
|
|
||||||
===================================================================
|
|
||||||
--- logrotate.c (revision 277)
|
|
||||||
+++ logrotate.c (working copy)
|
|
||||||
@@ -1293,7 +1293,7 @@
|
|
||||||
"since no logs will be rotated\n");
|
|
||||||
} else {
|
|
||||||
message(MESS_DEBUG, "running prerotate script\n");
|
|
||||||
- if (runScript(log->pattern, log->pre)) {
|
|
||||||
+ if (runScript(log->flags & LOG_FLAG_SHAREDSCRIPTS ? log->pattern : log->files[j], log->pre)) {
|
|
||||||
if (log->flags & LOG_FLAG_SHAREDSCRIPTS)
|
|
||||||
message(MESS_ERROR,
|
|
||||||
"error running shared prerotate script "
|
|
||||||
@@ -1328,7 +1328,7 @@
|
|
||||||
"since no logs were rotated\n");
|
|
||||||
} else {
|
|
||||||
message(MESS_DEBUG, "running postrotate script\n");
|
|
||||||
- if (runScript(log->pattern, log->post)) {
|
|
||||||
+ if (runScript(log->flags & LOG_FLAG_SHAREDSCRIPTS ? log->pattern : log->files[j], log->post)) {
|
|
||||||
if (log->flags & LOG_FLAG_SHAREDSCRIPTS)
|
|
||||||
message(MESS_ERROR,
|
|
||||||
"error running shared postrotate script "
|
|
@ -1,102 +0,0 @@
|
|||||||
Index: logrotate.8
|
|
||||||
===================================================================
|
|
||||||
--- logrotate.8 (revision 277)
|
|
||||||
+++ logrotate.8 (working copy)
|
|
||||||
@@ -217,6 +217,11 @@
|
|
||||||
The default value is -%Y%m%d. Note that also the character separating log
|
|
||||||
name from the extension is part of the dateformat string. The system clock
|
|
||||||
must be set past Sep 9th 2001 for %s to work correctly.
|
|
||||||
+Note that the datestamps generated by this format must be lexically sortable
|
|
||||||
+(i.e., first the year, then the month then the day. e.g., 2001/12/01 is ok,
|
|
||||||
+but 01/12/2001 is not, since 01/11/2002 would sort lower while it is later).
|
|
||||||
+This is because when using the \fBrotate\fR option, logrotate sorts all
|
|
||||||
+rotated filenames to find out which logfiles are older and should be removed.
|
|
||||||
|
|
||||||
.TP
|
|
||||||
\fBdelaycompress\fR
|
|
||||||
@@ -336,7 +341,8 @@
|
|
||||||
\fBnosharedscripts\fR
|
|
||||||
Run \fBprerotate\fR and \fBpostrotate\fR scripts for every log file which
|
|
||||||
is rotated (this is the default, and overrides the \fBsharedscripts\fR
|
|
||||||
-option). If the scripts exit with error, the remaining actions will
|
|
||||||
+option). The absolute path to the log file is passed as first argument
|
|
||||||
+to the script. If the scripts exit with error, the remaining actions will
|
|
||||||
not be executed for the affected log only.
|
|
||||||
|
|
||||||
.TP
|
|
||||||
@@ -359,36 +365,44 @@
|
|
||||||
.TP
|
|
||||||
\fBpostrotate\fR/\fBendscript\fR
|
|
||||||
The lines between \fBpostrotate\fR and \fBendscript\fR (both of which
|
|
||||||
-must appear on lines by themselves) are executed after the log file is
|
|
||||||
-rotated. These directives may only appear inside a log file definition.
|
|
||||||
+must appear on lines by themselves) are executed (using \fB/bin/sh\fR)
|
|
||||||
+after the log file is rotated. These directives may only appear inside
|
|
||||||
+a log file definition. Normally, the absolute path to the log file is
|
|
||||||
+passed as first argument to the script. If \fBsharedscripts\fR is specified,
|
|
||||||
+whole pattern is passed to the script.
|
|
||||||
See also \fBprerotate\fR. See \fBsharedscripts\fR and \fBnosharedscripts\fR
|
|
||||||
for error handling.
|
|
||||||
|
|
||||||
.TP
|
|
||||||
\fBprerotate\fR/\fBendscript\fR
|
|
||||||
The lines between \fBprerotate\fR and \fBendscript\fR (both of which
|
|
||||||
-must appear on lines by themselves) are executed before the log file is
|
|
||||||
-rotated and only if the log will actually be rotated. These directives
|
|
||||||
-may only appear inside a log file definition. See also \fBpostrotate\fR.
|
|
||||||
+must appear on lines by themselves) are executed (using \fB/bin/sh\fR) before
|
|
||||||
+the log file is rotated and only if the log will actually be rotated. These
|
|
||||||
+directives may only appear inside a log file definition. Normally,
|
|
||||||
+the absolute path to the log file is passed as first argument to the script.
|
|
||||||
+If \fBsharedscripts\fR is specified, whole pattern is passed to the script.
|
|
||||||
+See also \fBpostrotate\fR.
|
|
||||||
See \fBsharedscripts\fR and \fBnosharedscripts\fR for error handling.
|
|
||||||
|
|
||||||
.TP
|
|
||||||
\fBfirstaction\fR/\fBendscript\fR
|
|
||||||
The lines between \fBfirstaction\fR and \fBendscript\fR (both of which
|
|
||||||
-must appear on lines by themselves) are executed once before all log
|
|
||||||
-files that match the wildcarded pattern are rotated, before prerotate script
|
|
||||||
-is run and only if at least one log will actually be rotated. These directives
|
|
||||||
-may only appear inside a log file definition. If the script exits
|
|
||||||
-with error, no further processing is done. See also \fBlastaction\fR.
|
|
||||||
+must appear on lines by themselves) are executed (using \fB/bin/sh\fR) once
|
|
||||||
+before all log files that match the wildcarded pattern are rotated, before
|
|
||||||
+prerotate script is run and only if at least one log will actually be rotated.
|
|
||||||
+These directives may only appear inside a log file definition. Whole pattern is
|
|
||||||
+passed to the script as first argument. If the script exits with error,
|
|
||||||
+no further processing is done. See also \fBlastaction\fR.
|
|
||||||
|
|
||||||
.TP
|
|
||||||
\fBlastaction\fR/\fBendscript\fR
|
|
||||||
The lines between \fBlastaction\fR and \fBendscript\fR (both of which
|
|
||||||
-must appear on lines by themselves) are executed once after all log
|
|
||||||
-files that match the wildcarded pattern are rotated, after postrotate script
|
|
||||||
-is run and only if at least one log is rotated. These directives may only
|
|
||||||
-appear inside a log file definition. If the script exits with
|
|
||||||
-error, just an error message is shown (as this is the last
|
|
||||||
+must appear on lines by themselves) are executed (using \fB/bin/sh\fR) once
|
|
||||||
+after all log files that match the wildcarded pattern are rotated, after
|
|
||||||
+postrotate script is run and only if at least one log is rotated. These
|
|
||||||
+directives may only appear inside a log file definition. Whole pattern is
|
|
||||||
+passed to the script as first argument. If the script exits
|
|
||||||
+with error, just an error message is shown (as this is the last
|
|
||||||
action). See also \fBfirstaction\fR.
|
|
||||||
|
|
||||||
.TP
|
|
||||||
@@ -408,10 +422,12 @@
|
|
||||||
.TP
|
|
||||||
\fBsharedscripts\fR
|
|
||||||
Normally, \fBprerotate\fR and \fBpostrotate\fR scripts are run for each
|
|
||||||
-log which is rotated, meaning that a single script may be run multiple
|
|
||||||
+log which is rotated and the absolute path to the log file is passed as first
|
|
||||||
+argument to the script. That means a single script may be run multiple
|
|
||||||
times for log file entries which match multiple files (such as the
|
|
||||||
-\fI/var/log/news/*\fR example). If \fBsharedscript\fR is specified, the scripts
|
|
||||||
-are only run once, no matter how many logs match the wildcarded pattern.
|
|
||||||
+\fI/var/log/news/*\fR example). If \fBsharedscripts\fR is specified, the scripts
|
|
||||||
+are only run once, no matter how many logs match the wildcarded pattern,
|
|
||||||
+and whole pattern is passed to them.
|
|
||||||
However, if none of the logs in the pattern require rotating, the scripts
|
|
||||||
will not be run at all. If the scripts exit with error, the remaining
|
|
||||||
actions will not be executed for any logs. This option overrides the
|
|
@ -1,21 +1,11 @@
|
|||||||
Summary: Rotates, compresses, removes and mails system log files
|
Summary: Rotates, compresses, removes and mails system log files
|
||||||
Name: logrotate
|
Name: logrotate
|
||||||
Version: 3.7.8
|
Version: 3.7.9
|
||||||
Release: 12%{?dist}
|
Release: 1%{?dist}
|
||||||
License: GPL+
|
License: GPL+
|
||||||
Group: System Environment/Base
|
Group: System Environment/Base
|
||||||
Source: https://fedorahosted.org/releases/l/o/logrotate/logrotate-%{version}.tar.gz
|
Source: https://fedorahosted.org/releases/l/o/logrotate/logrotate-%{version}.tar.gz
|
||||||
Patch1: logrotate-3.7.7-curdir2.patch
|
#Patch1: logrotate-3.7.8-perm.patch
|
||||||
Patch2: logrotate-3.7.7-toolarge.patch
|
|
||||||
Patch3: logrotate-3.7.8-devnull.patch
|
|
||||||
Patch4: logrotate-3.7.8-man5.patch
|
|
||||||
Patch5: logrotate-3.7.8-readonly.patch
|
|
||||||
#Patch6: logrotate-3.7.8-perm.patch
|
|
||||||
Patch7: logrotate-3.7.8-missingok.patch
|
|
||||||
Patch8: logrotate-3.7.8-configsize.patch
|
|
||||||
Patch9: logrotate-3.7.8-dont-remove-log.patch
|
|
||||||
Patch10: logrotate-3.7.8-scripts-args.patch
|
|
||||||
Patch11: logrotate-3.7.8-scripts-man.patch
|
|
||||||
|
|
||||||
Requires: coreutils >= 5.92 libsepol libselinux popt
|
Requires: coreutils >= 5.92 libsepol libselinux popt
|
||||||
BuildRequires: libselinux-devel popt-devel
|
BuildRequires: libselinux-devel popt-devel
|
||||||
@ -34,17 +24,7 @@ log files on your system.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
%patch1 -p1 -b .curdir
|
#%%patch1 -p1 -b .perm
|
||||||
%patch2 -p1 -b .toolarge
|
|
||||||
%patch3 -p1 -b .devnull
|
|
||||||
%patch4 -p1 -b .man5
|
|
||||||
%patch5 -p1 -b .readonly
|
|
||||||
#%%patch6 -p1 -b .perm
|
|
||||||
%patch7 -p1 -b .missingok
|
|
||||||
%patch8 -p2 -b .configsize
|
|
||||||
%patch9 -b dont-remove-log.patch
|
|
||||||
%patch10 -b .scripts-args
|
|
||||||
%patch11 -b .scripts-man
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
make %{?_smp_mflags} RPM_OPT_FLAGS="$RPM_OPT_FLAGS" WITH_SELINUX=yes
|
make %{?_smp_mflags} RPM_OPT_FLAGS="$RPM_OPT_FLAGS" WITH_SELINUX=yes
|
||||||
@ -75,6 +55,10 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%attr(0644, root, root) %verify(not size md5 mtime) %config(noreplace) %{_localstatedir}/lib/logrotate.status
|
%attr(0644, root, root) %verify(not size md5 mtime) %config(noreplace) %{_localstatedir}/lib/logrotate.status
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
|
||||||
|
* Mon Jun 28 2010 Jan Kaluza <jkaluza@redhat.com> 3.7.9-1
|
||||||
|
- new upstream version 3.7.9
|
||||||
|
|
||||||
* Tue Jun 22 2010 Jan Kaluza <jkaluza@redhat.com> 3.7.8-12
|
* Tue Jun 22 2010 Jan Kaluza <jkaluza@redhat.com> 3.7.8-12
|
||||||
- fix #602643 - update manpage to reflect scripts changes
|
- fix #602643 - update manpage to reflect scripts changes
|
||||||
- fix #606675 - pass currently rotated file as argument to
|
- fix #606675 - pass currently rotated file as argument to
|
||||||
|
Loading…
Reference in New Issue
Block a user