Page MenuHomeFreeBSD

newsyslog: check for rename failure during log rotation
ClosedPublic

Authored by chris.longros_gmail.com on Mar 25 2026, 7:04 PM.
Tags
None
Referenced Files
F154255166: D56088.id174391.diff
Mon, Apr 27, 10:38 AM
Unknown Object (File)
Sun, Apr 26, 9:21 PM
Unknown Object (File)
Fri, Apr 24, 12:28 AM
Unknown Object (File)
Tue, Apr 21, 1:04 PM
Unknown Object (File)
Tue, Apr 21, 12:44 PM
Unknown Object (File)
Mon, Apr 20, 10:53 PM
Unknown Object (File)
Mon, Apr 20, 6:53 PM
Unknown Object (File)
Sun, Apr 19, 11:50 PM
Subscribers

Details

Summary

Add a missing error check on rename(2) when shifting compressed
log files. On failure, warn and skip the affected file.

Signed-off-by: Christos Longros <chris.longros@gmail.com>

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

warn wouldn't seem to be ideal to me, but it matches how everything else is reported for 'routine' or 'expected' errors.

This revision is now accepted and ready to land.Mar 25 2026, 7:16 PM
glebius added inline comments.
usr.sbin/newsyslog/newsyslog.c
1958–1960

That will more stylish.

usr.sbin/newsyslog/newsyslog.c
1958–1960

Do you maybe mean

else if (rename(zfile1, zfile2) != 0)

?

usr.sbin/newsyslog/newsyslog.c
1958–1960

Yes, of course, sorry for that.

This revision now requires review to proceed.Mar 26 2026, 7:00 PM
This comment was removed by chris.longros_gmail.com.
usr.sbin/newsyslog/newsyslog.c
1958–1960

Done !

This revision was not accepted when it landed; it landed in state Needs Review.Mar 27 2026, 7:30 PM
This revision was automatically updated to reflect the committed changes.