2008-09-06 00:08:20 +02:00
|
|
|
--- ./config.c.orig 2008-05-09 09:28:59.000000000 +0200
|
|
|
|
+++ ./config.c 2008-08-22 16:21:35.000000000 +0200
|
|
|
|
@@ -485,7 +485,7 @@
|
|
|
|
static int readConfigFile(const char *configFile, struct logInfo *defConfig)
|
2007-01-16 00:24:09 +01:00
|
|
|
{
|
|
|
|
int fd;
|
|
|
|
- char *buf, *endtag;
|
|
|
|
+ char *buf, *endtag, *compresscmd_base;
|
|
|
|
char oldchar, foo;
|
2008-09-06 00:08:20 +02:00
|
|
|
off_t length;
|
2007-01-16 00:24:09 +01:00
|
|
|
int lineNum = 1;
|
2008-09-06 00:08:20 +02:00
|
|
|
@@ -1182,6 +1182,18 @@
|
2007-01-16 00:24:09 +01:00
|
|
|
message(MESS_DEBUG, "compress_prog is now %s\n",
|
|
|
|
newlog->compress_prog);
|
|
|
|
|
|
|
|
+ compresscmd_base=strdup(basename(newlog->compress_prog));
|
|
|
|
+ i=0; /* have to check whether we may do this! */
|
|
|
|
+ /* we check whether we changed the compress_cmd. In case we use the apropriate extension
|
|
|
|
+ as listed in compress_cmd_list */
|
|
|
|
+ while ((i>=0)&&(strcmp(compress_cmd_list[i][0], "EOLIST"))){
|
|
|
|
+ if (0==strcmp(compress_cmd_list[i][0], compresscmd_base)){
|
|
|
|
+ newlog->compress_ext=strdup((char *)compress_cmd_list[i][1]);
|
|
|
|
+ message(MESS_DEBUG, "compress_ext was changed to %s\n", newlog->compress_ext);
|
|
|
|
+ i=-10; /* terminate loop! */
|
|
|
|
+ }
|
|
|
|
+ i++;
|
|
|
|
+ }
|
|
|
|
} else if (!strcmp(start, "uncompresscmd")) {
|
|
|
|
*endtag = oldchar, start = endtag;
|
|
|
|
|
2008-09-06 00:08:20 +02:00
|
|
|
--- ./logrotate.h.orig 2008-05-09 09:28:59.000000000 +0200
|
|
|
|
+++ ./logrotate.h 2008-08-22 16:38:13.000000000 +0200
|
|
|
|
@@ -61,6 +61,9 @@
|
|
|
|
extern int numLogs;
|
|
|
|
extern int debug;
|
|
|
|
|
|
|
|
+/* This is the definition. Note we have to carry the "2" within the declaration (logrotate.c), too! */
|
|
|
|
+extern const char * compress_cmd_list[][2];
|
|
|
|
+
|
|
|
|
int readAllConfigPaths(const char **paths);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
--- ./logrotate.c.orig 2008-05-14 12:31:35.000000000 +0200
|
|
|
|
+++ ./logrotate.c 2008-08-22 16:21:35.000000000 +0200
|
|
|
|
@@ -51,6 +51,15 @@
|
|
|
|
int numLogs = 0;
|
2007-01-16 00:24:09 +01:00
|
|
|
int debug = 0;
|
|
|
|
char *mailCommand = DEFAULT_MAIL_COMMAND;
|
|
|
|
+/* This is the declaration. Note the "2" is needed in the definition (logrotate.h), too! */
|
|
|
|
+const char * compress_cmd_list[][2] = {
|
|
|
|
+ {"gzip", ".gz"},
|
|
|
|
+ {"bzip2", ".bz2"},
|
|
|
|
+ {"compress", ".Z"},
|
|
|
|
+ {"zip", "zip"},
|
|
|
|
+ {"EOLIST", "EOLIST"} /* end-marker */
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
time_t nowSecs = 0;
|
|
|
|
|
2008-09-06 00:08:20 +02:00
|
|
|
static int shred_file(char *filename, struct logInfo *log);
|
|
|
|
@@ -278,7 +287,7 @@
|
2007-01-16 00:24:09 +01:00
|
|
|
char *uncompressCommand, char *address, char *subject)
|
|
|
|
{
|
|
|
|
int mailInput;
|
|
|
|
- pid_t mailChild, uncompressChild;
|
|
|
|
+ pid_t mailChild, uncompressChild=(pid_t) 0;
|
|
|
|
int mailStatus, uncompressStatus;
|
|
|
|
int uncompressPipe[2];
|
|
|
|
char *mailArgv[] = { mailCommand, "-s", subject, address, NULL };
|