summaryrefslogtreecommitdiffstats
path: root/usb.c
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-07-22 21:37:16 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-07-22 21:37:16 +0000
commitdf70f68c8e6bf2c8810c59a722812949460f1594 (patch)
tree536ca95d38f335ca378bff97ce3738c384d44c0c /usb.c
parent4ee281db510d8fe469b21925280ca6495f48c410 (diff)
downloadldetect-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"
Diffstat (limited to 'usb.c')
-rw-r--r--usb.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usb.c b/usb.c
index c41ca00..a92b871 100644
--- a/usb.c
+++ b/usb.c
@@ -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++) {