summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2005-03-21 23:44:04 +0000
committerpjd <pjd@FreeBSD.org>2005-03-21 23:44:04 +0000
commit0a7d613dc5ff1af98a07d9a2a1a778c2adcc0fb1 (patch)
tree6f1c727bc96fa20c79cda0f94739d63a4567f7d4 /sbin
parent17f1ca4d9be35266910db0dd4e5040f787d53eb9 (diff)
downloadFreeBSD-src-0a7d613dc5ff1af98a07d9a2a1a778c2adcc0fb1.zip
FreeBSD-src-0a7d613dc5ff1af98a07d9a2a1a778c2adcc0fb1.tar.gz
Truncate nextboot.conf file on creation, so existing garbage will be removed.
Submitted by: Gary Allan <dragonfly@gallan.plus.com> Obtained from: DragonFlyBSD MFC after: 3 days
Diffstat (limited to 'sbin')
-rw-r--r--sbin/reboot/reboot.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sbin/reboot/reboot.c b/sbin/reboot/reboot.c
index 6923640..0a52ba4 100644
--- a/sbin/reboot/reboot.c
+++ b/sbin/reboot/reboot.c
@@ -117,7 +117,8 @@ main(int argc, char *argv[])
}
if (kernel != NULL) {
- fd = open("/boot/nextboot.conf", O_WRONLY | O_CREAT, 0444);
+ fd = open("/boot/nextboot.conf", O_WRONLY | O_CREAT | O_TRUNC,
+ 0444);
if (fd > -1) {
(void)write(fd, "nextboot_enable=\"YES\"\n", 22);
(void)write(fd, "kernel=\"", 8L);
OpenPOWER on IntegriCloud