j
: Next unread message k
: Previous unread message j a
: Jump to all threads
j l
: Jump to MailingList overview
Author: blueswirl Date: Sat Aug 7 14:49:52 2010 New Revision: 839 URL: http://tracker.coreboot.org/trac/openbios/changeset/839
Log: loaders: fix open_ih return value checks
open_ih() returns -1 on error and 0 is a valid return value.
Signed-off-by: Blue Swirl blauwirbel@gmail.com
Modified: trunk/openbios-devel/libopenbios/aout_load.c trunk/openbios-devel/libopenbios/elf_load.c trunk/openbios-devel/libopenbios/fcode_load.c trunk/openbios-devel/libopenbios/forth_load.c
Modified: trunk/openbios-devel/libopenbios/aout_load.c ============================================================================== --- trunk/openbios-devel/libopenbios/aout_load.c Sat Aug 7 14:49:50 2010 (r838) +++ trunk/openbios-devel/libopenbios/aout_load.c Sat Aug 7 14:49:52 2010 (r839) @@ -81,8 +81,9 @@ feval("0 state-valid !");
fd = open_ih(dev); - if (!fd) + if (fd == -1) { goto out; + }
for (offset = 0; offset < 16 * 512; offset += 512) { seek_io(fd, offset);
Modified: trunk/openbios-devel/libopenbios/elf_load.c ============================================================================== --- trunk/openbios-devel/libopenbios/elf_load.c Sat Aug 7 14:49:50 2010 (r838) +++ trunk/openbios-devel/libopenbios/elf_load.c Sat Aug 7 14:49:52 2010 (r839) @@ -383,8 +383,9 @@ feval("0 state-valid !");
fd = open_ih(dev); - if (!fd) + if (fd == -1) { goto out; + }
offset = find_elf(&ehdr); if (!offset) {
Modified: trunk/openbios-devel/libopenbios/fcode_load.c ============================================================================== --- trunk/openbios-devel/libopenbios/fcode_load.c Sat Aug 7 14:49:50 2010 (r838) +++ trunk/openbios-devel/libopenbios/fcode_load.c Sat Aug 7 14:49:52 2010 (r839) @@ -35,8 +35,9 @@ feval("0 state-valid !");
fd = open_ih(dev); - if (!fd) + if (fd == -1) { goto out; + }
for (offset = 0; offset < 16 * 512; offset += 512) { seek_io(fd, offset);
Modified: trunk/openbios-devel/libopenbios/forth_load.c ============================================================================== --- trunk/openbios-devel/libopenbios/forth_load.c Sat Aug 7 14:49:50 2010 (r838) +++ trunk/openbios-devel/libopenbios/forth_load.c Sat Aug 7 14:49:52 2010 (r839) @@ -33,8 +33,9 @@ feval("0 state-valid !");
fd = open_ih(dev); - if (!fd) + if (fd == -1) { goto out; + }
if (read_io(fd, magic, 2) != 2) { debug("Can't read magic header\n");