/sbin/reboot editing /boot/nextboot.conf
Gary Allan
dragonfly at gallan.plus.com
Mon Mar 21 09:25:17 PST 2005
Hello,
The userland utility reboot(8) can leave garbage in
/boot/nextkernel.conf when specifying the next kernel to boot.
How to reproduce:
Running "reboot -k kernel.GENERIC" followed by "reboot -k kernel" leaves
/boot/nextboot.conf as:
kernel="/kernel"
ENERIC"
The attached patch truncates the file on opening.
Regards
Gary
diff -ru /usr/src.old/sbin/reboot/reboot.c /usr/src/sbin/reboot/reboot.c
--- /usr/src.old/sbin/reboot/reboot.c 2005-01-02 01:35:13.000000000 +0000
+++ /usr/src/sbin/reboot/reboot.c 2005-03-21 16:59:59.000000000 +0000
@@ -114,7 +114,7 @@
}
if (kflag) {
- 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) {
write(fd, "kernel=\"", 8L);
write(fd, kernel, strlen(kernel));
More information about the Submit
mailing list