On Sun, Nov 22, 2009 at 05:19:19PM +0000, Carles Pina i Estany wrote: > > Hello, > > Last night I spent some time with a confussion that maybe it can be > avoided (or maybe not). > > Let's say that a module calls grub_file_open and it fails (file doesn't > exist or whatever). grub_errno is setted up. > > This module is not resetting grub_errno and makes another call to > grub_file_open with a valid file. But grub_file_open does:
In theory, each layer should check errno after a call that may be setting it. It's up to the layer whether errno has to be ignored (and reset), handled or passed to the upper layer. If it's completely unchecked (i.e. not even reset), I think this is a bug. As you observed, it's a bit nasty; it can cause a routine to fail with an error that's completely unrelated to what the routine itself does. Help is much welcome on cleaning this kind of problems up. But it needs to be done carefully; it's very easy to unadvertedly work around the problem instead of fixing it (this happened sometimes in the past when sorting out errno handling problems). -- Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all." _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel