diff options
| author | Christos Longros <chris.longros@gmail.com> | 2026-03-27 19:28:42 +0000 |
|---|---|---|
| committer | Gleb Smirnoff <glebius@FreeBSD.org> | 2026-03-27 19:28:42 +0000 |
| commit | 6cf1afeccd8aaf926c58c5f0ee24ca3d2329a0ce (patch) | |
| tree | 44e2a9cc7bfc017874ce4a41cfa715822d2cddc0 | |
| parent | 833087185a6e9a2bd26707c57c83a71a541a825a (diff) | |
newsyslog: check for rename failure during log rotation
Differential Revision: https://reviews.freebsd.org/D56088
| -rw-r--r-- | usr.sbin/newsyslog/newsyslog.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/newsyslog/newsyslog.c b/usr.sbin/newsyslog/newsyslog.c index 084aeb36b052..fc8ba7df79af 100644 --- a/usr.sbin/newsyslog/newsyslog.c +++ b/usr.sbin/newsyslog/newsyslog.c @@ -1955,9 +1955,9 @@ do_rotate(const struct conf_entry *ent) if (noaction) printf("\tmv %s %s\n", zfile1, zfile2); - else { - /* XXX - Ought to be checking for failure! */ - (void)rename(zfile1, zfile2); + else if (rename(zfile1, zfile2) != 0) { + warn("can't mv %s to %s", zfile1, zfile2); + continue; } change_attrs(zfile2, ent); if (ent->compress && strlen(logfile_suffix) == 0) { |
