summaryrefslogtreecommitdiffstats
path: root/mdk-stage1
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2003-09-18 16:21:36 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2003-09-18 16:21:36 +0000
commit316188856741a4379ee5e4b9ab31ebcc3bfb7593 (patch)
treea63edef2aa8b7a41352e9514c7e6ff5b99f9683a /mdk-stage1
parent4d487752eea5b9dc15a581de1a5745ed868fcc1b (diff)
downloaddrakx-316188856741a4379ee5e4b9ab31ebcc3bfb7593.tar
drakx-316188856741a4379ee5e4b9ab31ebcc3bfb7593.tar.gz
drakx-316188856741a4379ee5e4b9ab31ebcc3bfb7593.tar.bz2
drakx-316188856741a4379ee5e4b9ab31ebcc3bfb7593.tar.xz
drakx-316188856741a4379ee5e4b9ab31ebcc3bfb7593.zip
close file descriptors
Diffstat (limited to 'mdk-stage1')
-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
}