Add checks for open_ih() return value

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@842 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
Blue Swirl
2010-08-08 18:50:22 +00:00
parent 84518defd6
commit 7d13c41dad
5 changed files with 47 additions and 20 deletions

View File

@@ -267,10 +267,14 @@ ext2_files_probe( ext2_info_t *dummy )
int fd, ret = 0;
fd = open_ih(ih);
if (ext2_probe(fd, offs))
ret = -1;
close_io(fd);
if (fd >= 0) {
if (ext2_probe(fd, offs)) {
ret = -1;
}
close_io(fd);
} else {
ret = -1;
}
RET (ret);
}

View File

@@ -336,6 +336,9 @@ grubfs_files_probe( grubfs_info_t *dummy )
int i;
curfs->dev_fd = open_ih(ih);
if (curfs->dev_fd == -1) {
RET( -1 );
}
curfs->offset = offs;
for (i = 0; i < sizeof(fsys_table)/sizeof(fsys_table[0]); i++) {

View File

@@ -479,8 +479,12 @@ hfs_files_volume_name( hfs_info_t *mi )
char *volname = malloc(VOLNAME_SIZE);
fd = open_ih(my_self());
get_hfs_vol_name(fd, volname, VOLNAME_SIZE);
close_io(fd);
if (fd >= 0) {
get_hfs_vol_name(fd, volname, VOLNAME_SIZE);
close_io(fd);
} else {
volname[0] = '\0';
}
PUSH ((ucell)volname);
}
@@ -546,10 +550,14 @@ hfs_files_probe( hfs_info_t *dummy )
int fd, ret = 0;
fd = open_ih(ih);
if (hfs_probe(fd, offs))
ret = -1;
close_io(fd);
if (fd >= 0) {
if (hfs_probe(fd, offs)) {
ret = -1;
}
close_io(fd);
} else {
ret = -1;
}
RET (ret);
}

View File

@@ -427,8 +427,12 @@ hfsp_files_volume_name( hfsp_info_t *mi )
char *volname = malloc(VOLNAME_SIZE);
fd = open_ih(my_self());
get_hfs_vol_name(fd, volname, VOLNAME_SIZE);
close_io(fd);
if (fd >= 0) {
get_hfs_vol_name(fd, volname, VOLNAME_SIZE);
close_io(fd);
} else {
volname[0] = '\0';
}
PUSH ((ucell)volname);
}
@@ -452,10 +456,14 @@ hfsp_files_probe( hfsp_info_t *dummy )
int fd, ret = 0;
fd = open_ih(ih);
if (volume_probe(fd, offs))
ret = -1;
close_io(fd);
if (fd >= 0) {
if (volume_probe(fd, offs)) {
ret = -1;
}
close_io(fd);
} else {
ret = -1;
}
RET (ret);
}

View File

@@ -219,10 +219,14 @@ iso9660_files_probe( iso9660_info_t *dummy )
int fd, ret = 0;
fd = open_ih(ih);
if (iso9660_probe(fd, offs))
ret = -1;
close_io(fd);
if (fd >= 0) {
if (iso9660_probe(fd, offs)) {
ret = -1;
}
close_io(fd);
} else {
ret = -1;
}
RET (ret);
}