summaryrefslogtreecommitdiffstats
path: root/usb.c
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-11-05 15:12:13 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-11-05 15:12:13 +0000
commit9f2530aadf482020a9a9453e35953a1a8c6a907e (patch)
tree024f91f292f39dcd521f968f4778f9817639722f /usb.c
parent00c56d093d9c70c877ac32afa4cb8b3e4f2e65c3 (diff)
downloadldetect-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 'usb.c')
-rw-r--r--usb.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/usb.c b/usb.c
index e667a5d..0ac6496 100644
--- a/usb.c
+++ b/usb.c
@@ -7,7 +7,8 @@
#include "libldetect-private.h"
#include "common.h"
-char *proc_usb_path = "/proc/bus/usb/devices";
+char *proc_usb_path_default = "/proc/bus/usb/devices";
+char *proc_usb_path = NULL;
extern struct pciusb_entries usb_probe(void) {
@@ -17,14 +18,10 @@ extern struct pciusb_entries usb_probe(void) {
struct pciusb_entries r;
struct pciusb_entry *e = NULL;
r.nb = 0;
- if (access(proc_usb_path, R_OK) != 0) {
- r.entries = NULL;
- return r;
- }
- if (!(f = fopen(proc_usb_path, "r"))) {
- char *err_msg;
- if (proc_usb_path==NULL || strcmp(proc_usb_path, "/proc/bus/usb/devices")) {
+ if (!(f = fopen(proc_usb_path ? proc_usb_path : proc_usb_path_default, "r"))) {
+ if (proc_usb_path) {
+ char *err_msg;
asprintf(&err_msg, "unable to open \"%s\"\n"
"You may have passed a wrong argument to the \"-u\" option.\n"
"fopen() sets errno to", proc_usb_path);