Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Feb 2024 06:04:50 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: 07cba2ddcb19 - main - reboot: Emulate nextboot -D better
Message-ID:  <202402210604.41L64oJ2074162@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=07cba2ddcb196c6e595df26a49ec0d54b1f2efe1

commit 07cba2ddcb196c6e595df26a49ec0d54b1f2efe1
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-02-21 06:03:15 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-02-21 06:04:56 +0000

    reboot: Emulate nextboot -D better
    
    It used to produce no output when the file couldn't be removed. Emulate
    that better by unlinking and ignoring errors. It's used at the end of
    reboot always, even when the file isn't going to be there.
    
    Sponsored by: Netflix
    Fixes: 2c479548119a
---
 sbin/reboot/reboot.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

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



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