diff options
author | Thierry Vignaud <tvignaud@mandriva.org> | 2002-07-16 15:29:55 +0000 |
---|---|---|
committer | Thierry Vignaud <tvignaud@mandriva.org> | 2002-07-16 15:29:55 +0000 |
commit | 3dfdaa1a0d7148f925339f060f9ccbc8ce3a7bc3 (patch) | |
tree | 440a8eaf9bb1bc82507c71d8b883b944f03cbeea /pci.c | |
parent | 3f6174dc0fcbfbd9a8e66220e6f166180eb4302c (diff) | |
download | ldetect-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.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -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]; |