opnsense-src/sbin/reboot
Warner Losh bec5a3c046 nextboot: Smarter warning about deleting nextboot
Read only filesystems always error when trying to remove something
with EROFS. However, that's true even if the file isn't there. The
code assumed it would always get a ENOENT if the file wasn't there,
but produced a gross message on read only systems. This message was
harmless, but annoying. Instead, stat the file first and return if
it's already not there.

Some readings of POSIX require that the ENOENT error take precidence
over the EROFS error. Linux made this change years ago, and we should
too. POSIX.1-2024 isn't explicit, but does say for unlink() does say
"[EROFS] The directory entry to be unlinked is part of a read-only file
system" and "[ENOENT] A component of path does not name an existing
file" implying that EROFS should only be returned for an existing
file. FreeBSD doesn't implement this, so this workaround is
necessary. Ideally, we'd fix this in the kernel in the future.

Sponsored by: Netflix
Discussed with: jrtc23
Differential Revision:	https://reviews.freebsd.org/D48425
2025-01-14 10:52:54 -07:00
..
boot_i386.8 sbin: Remove ancient SCCS tags. 2023-11-26 22:23:29 -07:00
Makefile Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
nextboot.8 Remove $FreeBSD$: two-line nroff pattern 2023-08-16 11:55:10 -06:00
reboot.8 man filesystems: fix xrefs after move to section 4 2024-05-16 10:25:29 -06:00
reboot.c nextboot: Smarter warning about deleting nextboot 2025-01-14 10:52:54 -07:00