Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Feb 2024 03:11:45 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: bad90cb4f686 - main - nextboot: check unlink, but only warn on !ENOENT
Message-ID:  <202402220311.41M3Bjso073975@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

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

commit bad90cb4f6860657917a485893ee790545286018
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-02-22 03:10:45 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-02-22 03:10:45 +0000

    nextboot: check unlink, but only warn on !ENOENT
    
    Emulate rm -f from the nextboot.sh script: Report all errors, except
    ENOENT. This problems show through, except the expected one when
    nextboot.conf isn't there.
    
    Sponsored by:           Netflix
    Reviewed by:            rew
    Differential Revision:  https://reviews.freebsd.org/D44013
---
 sbin/reboot/reboot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sbin/reboot/reboot.c b/sbin/reboot/reboot.c
index e245c78d83bc..3cc77aebe4d4 100644
--- a/sbin/reboot/reboot.c
+++ b/sbin/reboot/reboot.c
@@ -288,7 +288,8 @@ main(int argc, char *argv[])
 		errx(1, "-r and -k cannot be used together, there is no next kernel");
 
 	if (Dflag) {
-		(void)unlink(PATH_NEXTBOOT);	/* Say nothing if it's not there */
+		if (unlink(PATH_NEXTBOOT) != 0 && errno != ENOENT)
+			warn("unlink " PATH_NEXTBOOT);
 		exit(0);
 	}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202402220311.41M3Bjso073975>