On Sat, Jul 05, 2008 at 08:36:13PM +0200, Javier Martín wrote:
> > >    grub_disk_read (disk, 1 * 2, 0, sizeof (struct grub_ext2_sblock),
> > >                    (char *) &data->sblock);
> > >    if (grub_errno)
> > > -    goto fail;
> > > +    EXT2_DRIVER_MOUNT_FAIL("could not read the superblock")
> > 
> > This overrides the grub_errno and grub_errmsg provided by grub_disk_read and
> > replaces them with values that hide the true problem.  If there was a disk
> > read error, we really want to know about it from the lower layer.
> Well, the old version did just the same (even worse, because the message
> was generic). What would be the correct path of action here? I mean, how
> can we propagate the error messages?

It shouldn't call grub_error().

>   fail:
> -  grub_error (GRUB_ERR_BAD_FS, "not an ext2 filesystem");
> +  if (!err_msg)
> +    err_msg = "DEBUG: mount failed but no error message supplied!";

No need to check for consistency in your own code.  This might be a good
practice in userland programs but here it's a waste of space.  Just make sure
your code is correct.

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What good is a phone call… if you are unable to speak?
(as seen on /.)


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to