From 0a7d613dc5ff1af98a07d9a2a1a778c2adcc0fb1 Mon Sep 17 00:00:00 2001 From: pjd Date: Mon, 21 Mar 2005 23:44:04 +0000 Subject: Truncate nextboot.conf file on creation, so existing garbage will be removed. Submitted by: Gary Allan Obtained from: DragonFlyBSD MFC after: 3 days --- sbin/reboot/reboot.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sbin') 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); -- cgit v1.1