diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2002-07-22 21:37:16 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2002-07-22 21:37:16 +0000 |
commit | df70f68c8e6bf2c8810c59a722812949460f1594 (patch) | |
tree | 536ca95d38f335ca378bff97ce3738c384d44c0c | |
parent | 4ee281db510d8fe469b21925280ca6495f48c410 (diff) | |
download | ldetect-df70f68c8e6bf2c8810c59a722812949460f1594.tar ldetect-df70f68c8e6bf2c8810c59a722812949460f1594.tar.gz ldetect-df70f68c8e6bf2c8810c59a722812949460f1594.tar.bz2 ldetect-df70f68c8e6bf2c8810c59a722812949460f1594.tar.xz ldetect-df70f68c8e6bf2c8810c59a722812949460f1594.zip |
- don't die when missing /proc/bus/pci/devices (resp. /proc/bus/usb/devices),
since on some boxes, this is *normal*!
- free error messages obtained via asprintf
- remove debugging message "TOTO"
-rw-r--r-- | ldetect.spec | 8 | ||||
-rw-r--r-- | pci.c | 6 | ||||
-rw-r--r-- | usb.c | 9 |
3 files changed, 17 insertions, 6 deletions
diff --git a/ldetect.spec b/ldetect.spec index 32c5ca6..80cb31b 100644 --- a/ldetect.spec +++ b/ldetect.spec @@ -1,7 +1,7 @@ # !! DON'T MODIFY HERE, MODIFY IN THE CVS !! %define name ldetect %define version 0.4.2 -%define release 2mdk +%define release 3mdk Name: %{name} Version: %{version} @@ -53,6 +53,12 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/* %changelog +* Mon Jul 22 2002 Pixel <pixel@mandrakesoft.com> 0.4.2-3mdk +- don't die when missing /proc/bus/pci/devices (resp. /proc/bus/usb/devices), + since on some boxes, this is *normal*! +- free error messages obtained via asprintf +- remove debugging message "TOTO" + * Tue Jul 16 2002 Pixel <pixel@mandrakesoft.com> 0.4.2-2mdk - pciusb.c: teach titi that !(a && !b) is not (!a && !b) but (!a || b) (the other solution is to teach him to *test*) @@ -15,7 +15,6 @@ extern struct pciusb_entries pci_probe(int probe_type) { unsigned short devbusfn; unsigned int id; struct pciusb_entries r; - r.entries = malloc(sizeof(struct pciusb_entry) * MAX_DEVICES); if (!(f = fopen(proc_pci_path, "r"))) { char *err_msg; @@ -23,8 +22,11 @@ extern struct pciusb_entries pci_probe(int probe_type) { "You may have passed a wrong argument to the \"-p\" option.\n" "fopen() sets errno to", proc_pci_path); perror(err_msg); - exit(1); + free(err_msg); + r.nb = 0; r.entries = NULL; + return r; } + r.entries = malloc(sizeof(struct pciusb_entry) * MAX_DEVICES); for (r.nb = 0; fgets(buf, sizeof(buf) - 1, f) && r.nb < MAX_DEVICES; r.nb++) { struct pciusb_entry *e = &r.entries[r.nb]; @@ -19,8 +19,8 @@ extern struct pciusb_entries usb_probe(void) { struct pciusb_entry *e = NULL; if (access(proc_pci_path, R_OK) != 0) { - printf( "TOTO\n"); - exit(1); + r.nb = 0; r.entries = NULL; + return r; } if (!(f = fopen(proc_usb_path, "r"))) { @@ -30,13 +30,16 @@ extern struct pciusb_entries usb_probe(void) { "You may have passed a wrong argument to the \"-u\" option.\n" "fopen() sets errno to", proc_usb_path); perror(err_msg); + free(err_msg); } /*else { asprintf(&err_msg, "unable to open \"%s\"\n" "You should enable the usb service (as root, type 'service usb start'.\n" "fopen() sets errno to", proc_usb_path); perror(err_msg); + free(err_msg); } */ - exit(1); + r.nb = 0; r.entries = NULL; + return r; } for(r.nb = line = 0; fgets(buf, sizeof(buf) - 1, f) && r.nb < psizeof(t); line++) { |