- fixed segfault, if subdir does not exists

This commit is contained in:
Harald Hoyer 2008-01-21 13:31:25 +00:00
parent a9d8b8ab41
commit 91b1c681c7
2 changed files with 11 additions and 5 deletions

View File

@ -1,6 +1,6 @@
diff -up pciutils-2.2.9/lib/pci.h.dird pciutils-2.2.9/lib/pci.h diff -up pciutils-2.2.9/lib/pci.h.dird pciutils-2.2.9/lib/pci.h
--- pciutils-2.2.9/lib/pci.h.dird 2006-09-09 14:46:06.000000000 +0200 --- pciutils-2.2.9/lib/pci.h.dird 2006-09-09 14:46:06.000000000 +0200
+++ pciutils-2.2.9/lib/pci.h 2008-01-18 09:51:03.000000000 +0100 +++ pciutils-2.2.9/lib/pci.h 2008-01-21 14:27:27.000000000 +0100
@@ -162,6 +162,7 @@ char *pci_lookup_name(struct pci_access @@ -162,6 +162,7 @@ char *pci_lookup_name(struct pci_access
int pci_load_name_list(struct pci_access *a); /* Called automatically by pci_lookup_*() when needed; returns success */ int pci_load_name_list(struct pci_access *a); /* Called automatically by pci_lookup_*() when needed; returns success */
void pci_free_name_list(struct pci_access *a); /* Called automatically by pci_cleanup() */ void pci_free_name_list(struct pci_access *a); /* Called automatically by pci_cleanup() */
@ -10,8 +10,8 @@ diff -up pciutils-2.2.9/lib/pci.h.dird pciutils-2.2.9/lib/pci.h
enum pci_lookup_mode { enum pci_lookup_mode {
PCI_LOOKUP_VENDOR = 1, /* Vendor name (args: vendorID) */ PCI_LOOKUP_VENDOR = 1, /* Vendor name (args: vendorID) */
diff -up pciutils-2.2.9/lib/names.c.dird pciutils-2.2.9/lib/names.c diff -up pciutils-2.2.9/lib/names.c.dird pciutils-2.2.9/lib/names.c
--- pciutils-2.2.9/lib/names.c.dird 2008-01-18 09:51:03.000000000 +0100 --- pciutils-2.2.9/lib/names.c.dird 2008-01-21 14:27:27.000000000 +0100
+++ pciutils-2.2.9/lib/names.c 2008-01-18 09:54:28.000000000 +0100 +++ pciutils-2.2.9/lib/names.c 2008-01-21 14:29:55.000000000 +0100
@@ -11,6 +11,8 @@ @@ -11,6 +11,8 @@
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
@ -58,7 +58,7 @@ diff -up pciutils-2.2.9/lib/names.c.dird pciutils-2.2.9/lib/names.c
return 1; return 1;
} }
@@ -548,3 +550,46 @@ void pci_set_name_list_path(struct pci_a @@ -548,3 +550,49 @@ void pci_set_name_list_path(struct pci_a
a->id_file_name = name; a->id_file_name = name;
a->free_id_name = to_be_freed; a->free_id_name = to_be_freed;
} }
@ -77,6 +77,9 @@ diff -up pciutils-2.2.9/lib/names.c.dird pciutils-2.2.9/lib/names.c
+ strncat(new_id_path, ".d/", PATH_MAX - strnlen(new_id_path, PATH_MAX)); + strncat(new_id_path, ".d/", PATH_MAX - strnlen(new_id_path, PATH_MAX));
+ /* printf("new_id_path is %s\n", new_id_path); */ + /* printf("new_id_path is %s\n", new_id_path); */
+ pci_ids_dir = opendir(new_id_path); + pci_ids_dir = opendir(new_id_path);
+ if (pci_ids_dir == NULL)
+ return 0;
+
+ do + do
+ { + {
+ if ((dp = readdir(pci_ids_dir)) != NULL) + if ((dp = readdir(pci_ids_dir)) != NULL)

View File

@ -1,6 +1,6 @@
Name: pciutils Name: pciutils
Version: 2.2.9 Version: 2.2.9
Release: 3%{?dist} Release: 4%{?dist}
Source: ftp://atrey.karlin.mff.cuni.cz/pub/linux/pci/%{name}-%{version}.tar.gz Source: ftp://atrey.karlin.mff.cuni.cz/pub/linux/pci/%{name}-%{version}.tar.gz
Patch0: pciutils-strip.patch Patch0: pciutils-strip.patch
Patch1: pciutils-2.2.4-buf.patch Patch1: pciutils-2.2.4-buf.patch
@ -78,6 +78,9 @@ install -p lib/libpci.pc $RPM_BUILD_ROOT%{_libdir}/pkgconfig
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
%changelog %changelog
* Mon Jan 21 2008 Harald Hoyer <harald@redhat.com> 2.2.9-4
- fixed segfault, if subdir does not exists
* Fri Jan 18 2008 Harald Hoyer <harald@redhat.com> 2.2.9-3 * Fri Jan 18 2008 Harald Hoyer <harald@redhat.com> 2.2.9-3
- removed static library, preserve timestamps on install (rhbz#226236) - removed static library, preserve timestamps on install (rhbz#226236)
- added modified patch from Michael E. Brown @ Dell, to also - added modified patch from Michael E. Brown @ Dell, to also