mirror of
https://github.com/sheumann/hush.git
synced 2024-12-22 14:30:31 +00:00
syslogd: do not error out on missing files to rotate. closes bug 3404.
This commit is contained in:
parent
bd23fbbd0a
commit
69dc325397
@ -347,10 +347,11 @@ static void log_locally(time_t now, char *msg)
|
|||||||
sprintf(newFile, "%s.%d", G.logFilePath, i);
|
sprintf(newFile, "%s.%d", G.logFilePath, i);
|
||||||
if (i == 0) break;
|
if (i == 0) break;
|
||||||
sprintf(oldFile, "%s.%d", G.logFilePath, --i);
|
sprintf(oldFile, "%s.%d", G.logFilePath, --i);
|
||||||
xrename(oldFile, newFile);
|
/* ignore errors - file might be missing */
|
||||||
|
rename(oldFile, newFile);
|
||||||
}
|
}
|
||||||
/* newFile == "f.0" now */
|
/* newFile == "f.0" now */
|
||||||
xrename(G.logFilePath, newFile);
|
rename(G.logFilePath, newFile);
|
||||||
fl.l_type = F_UNLCK;
|
fl.l_type = F_UNLCK;
|
||||||
fcntl(G.logFD, F_SETLKW, &fl);
|
fcntl(G.logFD, F_SETLKW, &fl);
|
||||||
close(G.logFD);
|
close(G.logFD);
|
||||||
|
Loading…
Reference in New Issue
Block a user