Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Mar 2026 19:29:43 +0000
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Cc:        Christos Longros <chris.longros@gmail.com>
Subject:   git: 6cf1afeccd8a - main - newsyslog: check for rename failure during log rotation
Message-ID:  <69c6daa7.1d2d4.4bb254d1@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=6cf1afeccd8aaf926c58c5f0ee24ca3d2329a0ce

commit 6cf1afeccd8aaf926c58c5f0ee24ca3d2329a0ce
Author:     Christos Longros <chris.longros@gmail.com>
AuthorDate: 2026-03-27 19:28:42 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2026-03-27 19:28:42 +0000

    newsyslog: check for rename failure during log rotation
    
    Differential Revision:  https://reviews.freebsd.org/D56088
---
 usr.sbin/newsyslog/newsyslog.c | 6 +++---
 1 file 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) {


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69c6daa7.1d2d4.4bb254d1>