diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2002-11-05 15:12:13 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2002-11-05 15:12:13 +0000 |
commit | 9f2530aadf482020a9a9453e35953a1a8c6a907e (patch) | |
tree | 024f91f292f39dcd521f968f4778f9817639722f /pci.c | |
parent | 00c56d093d9c70c877ac32afa4cb8b3e4f2e65c3 (diff) | |
download | ldetect-9f2530aadf482020a9a9453e35953a1a8c6a907e.tar ldetect-9f2530aadf482020a9a9453e35953a1a8c6a907e.tar.gz ldetect-9f2530aadf482020a9a9453e35953a1a8c6a907e.tar.bz2 ldetect-9f2530aadf482020a9a9453e35953a1a8c6a907e.tar.xz ldetect-9f2530aadf482020a9a9453e35953a1a8c6a907e.zip |
no error message when -p is not used and there is neither pci nor usb bus
Diffstat (limited to 'pci.c')
-rw-r--r-- | pci.c | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -7,7 +7,8 @@ #include "libldetect-private.h" #include "common.h" -char *proc_pci_path = "/proc/bus/pci/devices"; +char *proc_pci_path_default = "/proc/bus/pci/devices"; +char *proc_pci_path = NULL; extern struct pciusb_entries pci_probe(int probe_type) { FILE *f, *devf; @@ -19,13 +20,15 @@ extern struct pciusb_entries pci_probe(int probe_type) { char file[25]; r.nb = 0; - if (!(f = fopen(proc_pci_path, "r"))) { - char *err_msg; - asprintf(&err_msg, "unable to open \"%s\"\n" - "You may have passed a wrong argument to the \"-p\" option.\n" - "fopen() sets errno to", proc_pci_path); - perror(err_msg); - free(err_msg); + if (!(f = fopen(proc_pci_path ? proc_pci_path : proc_pci_path_default, "r"))) { + if (proc_pci_path) { + char *err_msg; + asprintf(&err_msg, "unable to open \"%s\"\n" + "You may have passed a wrong argument to the \"-p\" option.\n" + "fopen() sets errno to", proc_pci_path); + perror(err_msg); + free(err_msg); + } r.entries = NULL; return r; } |