From 07cba2ddcb196c6e595df26a49ec0d54b1f2efe1 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Tue, 20 Feb 2024 23:03:15 -0700 Subject: [PATCH] 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 ac3927cc243..e245c78d83b 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); }