git: bad90cb4f686 - main - nextboot: check unlink, but only warn on !ENOENT
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 22 Feb 2024 03:11:45 UTC
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);
}