summaryrefslogtreecommitdiffstats
path: root/pci.c
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2002-07-16 15:29:55 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2002-07-16 15:29:55 +0000
commit3dfdaa1a0d7148f925339f060f9ccbc8ce3a7bc3 (patch)
tree440a8eaf9bb1bc82507c71d8b883b944f03cbeea /pci.c
parent3f6174dc0fcbfbd9a8e66220e6f166180eb4302c (diff)
downloadldetect-3dfdaa1a0d7148f925339f060f9ccbc8ce3a7bc3.tar
ldetect-3dfdaa1a0d7148f925339f060f9ccbc8ce3a7bc3.tar.gz
ldetect-3dfdaa1a0d7148f925339f060f9ccbc8ce3a7bc3.tar.bz2
ldetect-3dfdaa1a0d7148f925339f060f9ccbc8ce3a7bc3.tar.xz
ldetect-3dfdaa1a0d7148f925339f060f9ccbc8ce3a7bc3.zip
- print error message if unable to open the arguement passed to -u,-p
- print error message if usb service isn't started (commented for now to follow previous behaviour)
Diffstat (limited to 'pci.c')
-rw-r--r--pci.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/pci.c b/pci.c
index 6482de7..fba8ad4 100644
--- a/pci.c
+++ b/pci.c
@@ -1,3 +1,5 @@
+#include <unistd.h>
+#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -16,8 +18,14 @@ extern struct pciusb_entries pci_probe(int probe_type) {
struct pciusb_entries r;
r.entries = malloc(sizeof(struct pciusb_entry) * MAX_DEVICES);
- if (!(f = fopen(proc_pci_path, "r")))
+ 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);
exit(1);
+ }
for (r.nb = 0; fgets(buf, sizeof(buf) - 1, f) && r.nb < MAX_DEVICES; r.nb++) {
struct pciusb_entry *e = &r.entries[r.nb];