forked from github/server
ignore file-not-found errors when trying to rotate logs.
I suspect this is faster and safer than testing existence.
This commit is contained in:
parent
8f9bfe85b6
commit
32384f9fd7
|
@ -104,7 +104,7 @@ void log_rotate(const char *filename, int maxindex)
|
||||||
int err, src = 1 - dst;
|
int err, src = 1 - dst;
|
||||||
sprintf(buffer[src], "%s.%d", filename, --maxindex);
|
sprintf(buffer[src], "%s.%d", filename, --maxindex);
|
||||||
err = rename(buffer[src], buffer[dst]);
|
err = rename(buffer[src], buffer[dst]);
|
||||||
if (err != 0) {
|
if (err != 0 && err != ENOENT) {
|
||||||
fprintf(stderr, "log rotate %s: %s", buffer[dst], strerror(errno));
|
fprintf(stderr, "log rotate %s: %s", buffer[dst], strerror(errno));
|
||||||
}
|
}
|
||||||
dst = src;
|
dst = src;
|
||||||
|
|
Loading…
Reference in New Issue