diff options
Diffstat (limited to 'meta/recipes-extended/logrotate/logrotate/act-as-mv-when-rotate.patch')
-rw-r--r-- | meta/recipes-extended/logrotate/logrotate/act-as-mv-when-rotate.patch | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/meta/recipes-extended/logrotate/logrotate/act-as-mv-when-rotate.patch b/meta/recipes-extended/logrotate/logrotate/act-as-mv-when-rotate.patch index 2e931a2876..04cb588db1 100644 --- a/meta/recipes-extended/logrotate/logrotate/act-as-mv-when-rotate.patch +++ b/meta/recipes-extended/logrotate/logrotate/act-as-mv-when-rotate.patch | |||
@@ -1,4 +1,4 @@ | |||
1 | From 68f29ab490cf987aa34b5f4caf1784b58a021308 Mon Sep 17 00:00:00 2001 | 1 | From 517cbff66c8bdbf455bc3b7c1a85a4f990d0f9a6 Mon Sep 17 00:00:00 2001 |
2 | From: Robert Yang <liezhi.yang@windriver.com> | 2 | From: Robert Yang <liezhi.yang@windriver.com> |
3 | Date: Tue, 17 Feb 2015 21:08:07 -0800 | 3 | Date: Tue, 17 Feb 2015 21:08:07 -0800 |
4 | Subject: [PATCH] Act as the "mv" command when rotate log | 4 | Subject: [PATCH] Act as the "mv" command when rotate log |
@@ -10,14 +10,14 @@ Upstream-Status: Pending | |||
10 | 10 | ||
11 | Signed-off-by: Robert Yang <liezhi.yang@windriver.com> | 11 | Signed-off-by: Robert Yang <liezhi.yang@windriver.com> |
12 | --- | 12 | --- |
13 | logrotate.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++---------- | 13 | logrotate.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++----------- |
14 | 1 file changed, 59 insertions(+), 12 deletions(-) | 14 | 1 file changed, 60 insertions(+), 12 deletions(-) |
15 | 15 | ||
16 | diff --git a/logrotate.c b/logrotate.c | 16 | diff --git a/logrotate.c b/logrotate.c |
17 | index d3deb6a..cf8bf2c 100644 | 17 | index 4ad58d4..ba05884 100644 |
18 | --- a/logrotate.c | 18 | --- a/logrotate.c |
19 | +++ b/logrotate.c | 19 | +++ b/logrotate.c |
20 | @@ -1157,6 +1157,53 @@ int findNeedRotating(struct logInfo *log, int logNum, int force) | 20 | @@ -1315,6 +1315,54 @@ static int findNeedRotating(struct logInfo *log, int logNum, int force) |
21 | return 0; | 21 | return 0; |
22 | } | 22 | } |
23 | 23 | ||
@@ -68,10 +68,11 @@ index d3deb6a..cf8bf2c 100644 | |||
68 | + return 1; | 68 | + return 1; |
69 | +} | 69 | +} |
70 | + | 70 | + |
71 | int prerotateSingleLog(struct logInfo *log, int logNum, struct logState *state, | 71 | + |
72 | struct logNames *rotNames) | 72 | static int prerotateSingleLog(struct logInfo *log, int logNum, |
73 | struct logState *state, struct logNames *rotNames) | ||
73 | { | 74 | { |
74 | @@ -1523,15 +1570,15 @@ int prerotateSingleLog(struct logInfo *log, int logNum, struct logState *state, | 75 | @@ -1674,15 +1722,15 @@ static int prerotateSingleLog(struct logInfo *log, int logNum, |
75 | } | 76 | } |
76 | 77 | ||
77 | message(MESS_DEBUG, | 78 | message(MESS_DEBUG, |
@@ -90,7 +91,7 @@ index d3deb6a..cf8bf2c 100644 | |||
90 | oldName, newName, strerror(errno)); | 91 | oldName, newName, strerror(errno)); |
91 | hasErrors = 1; | 92 | hasErrors = 1; |
92 | } | 93 | } |
93 | @@ -1669,21 +1716,21 @@ int rotateSingleLog(struct logInfo *log, int logNum, struct logState *state, | 94 | @@ -1767,21 +1815,21 @@ static int rotateSingleLog(struct logInfo *log, int logNum, |
94 | return 1; | 95 | return 1; |
95 | } | 96 | } |
96 | 97 | ||
@@ -115,19 +116,19 @@ index d3deb6a..cf8bf2c 100644 | |||
115 | - message(MESS_ERROR, "failed to rename %s to %s: %s\n", | 116 | - message(MESS_ERROR, "failed to rename %s to %s: %s\n", |
116 | + mvFile(log->files[logNum], rotNames->finalName, log, prev_acl)) { | 117 | + mvFile(log->files[logNum], rotNames->finalName, log, prev_acl)) { |
117 | + message(MESS_ERROR, "failed to move %s to %s: %s\n", | 118 | + message(MESS_ERROR, "failed to move %s to %s: %s\n", |
118 | log->files[logNum], tmpFilename, | 119 | log->files[logNum], rotNames->finalName, |
119 | strerror(errno)); | 120 | strerror(errno)); |
120 | hasErrors = 1; | 121 | hasErrors = 1; |
121 | @@ -2063,7 +2110,7 @@ int rotateLogSet(struct logInfo *log, int force) | 122 | @@ -2170,7 +2218,7 @@ static int rotateLogSet(struct logInfo *log, int force) |
122 | return hasErrors; | 123 | return hasErrors; |
123 | } | 124 | } |
124 | 125 | ||
125 | -static int writeState(char *stateFilename) | 126 | -static int writeState(const char *stateFilename) |
126 | +static int writeState(struct logInfo *log, char *stateFilename) | 127 | +static int writeState(struct logInfo *log, char *stateFilename) |
127 | { | 128 | { |
128 | struct logState *p; | 129 | struct logState *p; |
129 | FILE *f; | 130 | FILE *f; |
130 | @@ -2227,7 +2274,7 @@ static int writeState(char *stateFilename) | 131 | @@ -2322,7 +2370,7 @@ static int writeState(const char *stateFilename) |
131 | fclose(f); | 132 | fclose(f); |
132 | 133 | ||
133 | if (error == 0) { | 134 | if (error == 0) { |
@@ -136,7 +137,7 @@ index d3deb6a..cf8bf2c 100644 | |||
136 | unlink(tmpFilename); | 137 | unlink(tmpFilename); |
137 | error = 1; | 138 | error = 1; |
138 | message(MESS_ERROR, "error renaming temp state file %s\n", | 139 | message(MESS_ERROR, "error renaming temp state file %s\n", |
139 | @@ -2525,7 +2572,7 @@ int main(int argc, const char **argv) | 140 | @@ -2648,7 +2696,7 @@ int main(int argc, const char **argv) |
140 | rc |= rotateLogSet(log, force); | 141 | rc |= rotateLogSet(log, force); |
141 | 142 | ||
142 | if (!debug) | 143 | if (!debug) |
@@ -145,3 +146,6 @@ index d3deb6a..cf8bf2c 100644 | |||
145 | 146 | ||
146 | return (rc != 0); | 147 | return (rc != 0); |
147 | } | 148 | } |
149 | -- | ||
150 | 1.8.3.1 | ||
151 | |||