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: 2c47954811
This commit is contained in:
Warner Losh 2024-02-20 23:03:15 -07:00
parent c7d5cc6f5e
commit 07cba2ddcb

View File

@ -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);
}