Bug#378243: grub-reboot does not work
Peter Karbaliotis
peter.karbaliotis at gmail.com
Tue Jan 2 01:32:13 CET 2007
It's no wonder that grub-reboot doesn't work. The saveddefault.diff
in debian/patches contains the following code:
+ if(!(fp = fopen(default_file,"w")))
+ {
+ errnum = ERR_READ;
+ goto fail;
+ }
+
+ read(&line, -1);
+
+ sscanf(line, "%d:%d", &curr_prev_default, &curr_default);
The "w" option in fopen means that the file is being opened for
writing only and is truncated to zero length. The read and sscanf
will therefore fail and fail silently since no error checking is done.
It would seem to make more sense to use the GRUB I/O functions
grub_{open,read,write,close} here. Indeed, the 'read(&line,-1)'
suggests the intention to use grub_read.
More information about the Pkg-grub-devel
mailing list