syslogd: do not error out on missing files to rotate. closes bug 3404.
authorDenis Vlasenko <vda.linux@googlemail.com>
Sat, 24 May 2008 21:03:53 +0000 (21:03 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Sat, 24 May 2008 21:03:53 +0000 (21:03 -0000)
sysklogd/syslogd.c

index f8fc5178056328480f6508ab53e9466884d6c793..1b8d718f471bceea43959bd43689ea65a35947e7 100644 (file)
@@ -347,10 +347,11 @@ static void log_locally(time_t now, char *msg)
                                sprintf(newFile, "%s.%d", G.logFilePath, i);
                                if (i == 0) break;
                                sprintf(oldFile, "%s.%d", G.logFilePath, --i);
-                               xrename(oldFile, newFile);
+                               /* ignore errors - file might be missing */
+                               rename(oldFile, newFile);
                        }
                        /* newFile == "f.0" now */
-                       xrename(G.logFilePath, newFile);
+                       rename(G.logFilePath, newFile);
                        fl.l_type = F_UNLCK;
                        fcntl(G.logFD, F_SETLKW, &fl);
                        close(G.logFD);