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:
Enno Rehling 2016-08-05 17:21:29 +02:00
parent 8f9bfe85b6
commit 32384f9fd7
1 changed files with 1 additions and 1 deletions

View File

@ -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;