summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mdk-stage1/disk.c6
-rw-r--r--mdk-stage1/probing.c10
2 files changed, 10 insertions, 6 deletions
diff --git a/mdk-stage1/disk.c b/mdk-stage1/disk.c
index a5bc8de4b..83c698334 100644
--- a/mdk-stage1/disk.c
+++ b/mdk-stage1/disk.c
@@ -86,6 +86,7 @@ static const char * detect_partition_type(char * dev)
int partitions_signatures_nb = sizeof(partitions_signatures) / sizeof(struct partition_detection_info);
int i;
int fd;
+ const char *part_type = NULL;
char device_fullname[50];
strcpy(device_fullname, "/dev/");
@@ -124,12 +125,13 @@ static const char * detect_partition_type(char * dev)
continue;
detect_partition_found_it:
- return partitions_signatures[i].name;
+ part_type = partitions_signatures[i].name;
+ break;
}
detect_partition_type_end:
close(fd);
- return NULL;
+ return part_type;
}
static char * disk_extract_list_directory(char * direct)
diff --git a/mdk-stage1/probing.c b/mdk-stage1/probing.c
index 3fc80db51..4a1b9a0dc 100644
--- a/mdk-stage1/probing.c
+++ b/mdk-stage1/probing.c
@@ -163,7 +163,7 @@ void probe_that_type(enum driver_type type, enum media_bus bus __attribute__ ((u
{
/* ---- PCI probe ---------------------------------------------- */
{
- FILE * f;
+ FILE * f = NULL;
unsigned int len = 0;
unsigned int len_full = 0;
char buf[200];
@@ -265,8 +265,9 @@ void probe_that_type(enum driver_type type, enum media_bus bus __attribute__ ((u
}
next_pci_device:;
}
- fclose(f);
end_pci_probe:;
+ if (f)
+ fclose(f);
}
@@ -276,7 +277,7 @@ void probe_that_type(enum driver_type type, enum media_bus bus __attribute__ ((u
static int already_probed_usb_controllers = 0;
static int already_mounted_usbdev = 0;
- FILE * f;
+ FILE * f = NULL;
int len = 0;
char buf[200];
struct usb_module_map * usbdb = NULL;
@@ -340,8 +341,9 @@ void probe_that_type(enum driver_type type, enum media_bus bus __attribute__ ((u
}
}
}
- fclose(f);
end_usb_probe:;
+ if (f)
+ fclose(f);
}
#endif
}