ded26fb957
- Change compression scheme to xz. This should give smaller resulting filesizes. OBS-URL: https://build.opensuse.org/request/show/78660 OBS-URL: https://build.opensuse.org/package/show/Base:System/logrotate?expand=0&rev=14
68 lines
2.3 KiB
Diff
68 lines
2.3 KiB
Diff
Index: config.c
|
|
===================================================================
|
|
--- config.c.orig 2008-06-02 12:26:14.000000000 +0200
|
|
+++ config.c 2009-03-06 14:21:45.000000000 +0100
|
|
@@ -483,7 +483,7 @@
|
|
static int readConfigFile(const char *configFile, struct logInfo *defConfig)
|
|
{
|
|
int fd;
|
|
- char *buf, *endtag;
|
|
+ char *buf, *endtag, *compresscmd_base;
|
|
char oldchar, foo;
|
|
off_t length;
|
|
int lineNum = 1;
|
|
@@ -1189,6 +1189,18 @@
|
|
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;
|
|
|
|
Index: logrotate.c
|
|
===================================================================
|
|
--- logrotate.c.orig 2008-10-15 15:07:43.000000000 +0200
|
|
+++ logrotate.c 2009-03-06 14:21:45.000000000 +0100
|
|
@@ -54,6 +54,16 @@
|
|
int numLogs = 0;
|
|
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"},
|
|
+ {"xz", ".xz"},
|
|
+ {"compress", ".Z"},
|
|
+ {"zip", "zip"},
|
|
+ {"EOLIST", "EOLIST"} /* end-marker */
|
|
+};
|
|
+
|
|
time_t nowSecs = 0;
|
|
|
|
static int shred_file(char *filename, struct logInfo *log);
|
|
Index: logrotate.h
|
|
===================================================================
|
|
--- logrotate.h.orig 2008-05-09 09:28:59.000000000 +0200
|
|
+++ logrotate.h 2009-03-06 14:21:45.000000000 +0100
|
|
@@ -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
|