Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 360849 | Differences between
and this patch

Collapse All | Expand All

(-)udev-164.orig/extras/usb-db/usb-db.c (-13 / +19 lines)
Lines 37-42 Link Here
37
# error "Are you havin' a laugh?"
37
# error "Are you havin' a laugh?"
38
#endif
38
#endif
39
39
40
#include <zlib.h>
41
#define data_file gzFile
42
#define data_fopen(path, mode) gzopen(path, mode)
43
#define data_fgets(s, size, stream) gzgets(stream, s, size)
44
#define data_close(f) gzclose(f)
45
40
static int get_id_attr(
46
static int get_id_attr(
41
	struct udev_device *parent,
47
	struct udev_device *parent,
42
	const char *name,
48
	const char *name,
Lines 96-124 Link Here
96
	char **vendor,
102
	char **vendor,
97
	char **product) {
103
	char **product) {
98
104
99
	FILE *f;
105
	data_file f;
100
	int ret = -1;
106
	int ret = -1;
101
	int found_vendor = 0;
107
	int found_vendor = 0;
102
	char *line = NULL;
108
	char buf[512], *line;
109
	char *filename = DATABASE ;
103
110
104
	*vendor = *product = NULL;
111
	*vendor = *product = NULL;
105
112
106
	if (!(f = fopen(DATABASE, "r"))) {
113
	filename = DATABASE".gz";
107
		fprintf(stderr, "Failed to open database file "DATABASE": %s\n", strerror(errno));
114
	if (!(f = data_fopen(filename, "r"))) {
115
		filename = DATABASE;
116
		if (!(f = data_fopen(filename, "r"))) {
117
			fprintf(stderr, "Failed to open database file "DATABASE": %s\n", strerror(errno));
108
		return -1;
118
		return -1;
109
	}
119
		}
120
	}		
110
121
111
	for (;;) {
122
	for (;;) {
112
		size_t n;
123
		size_t n;
113
124
114
		if (line) {
125
		if (data_fgets(buf, sizeof(buf), f) < 0)
115
			free(line);
116
			line = NULL;
117
		}
118
119
		if (getline(&line, &n, f) < 0)
120
			break;
126
			break;
121
127
128
		line = buf;
122
		rstrip(line);
129
		rstrip(line);
123
130
124
		if (line[0] == '#' || line[0] == 0)
131
		if (line[0] == '#' || line[0] == 0)
Lines 169-176 Link Here
169
	ret = 0;
176
	ret = 0;
170
177
171
finish:
178
finish:
172
	free(line);
179
	data_close(f);
173
	fclose(f);
174
180
175
	if (ret < 0) {
181
	if (ret < 0) {
176
		free(*product);
182
		free(*product);
(-)udev-164.orig/Makefile.am (-2 / +2 lines)
Lines 478-484 Link Here
478
# ------------------------------------------------------------------------------
478
# ------------------------------------------------------------------------------
479
extras_usb_db_usb_db_SOURCES = extras/usb-db/usb-db.c
479
extras_usb_db_usb_db_SOURCES = extras/usb-db/usb-db.c
480
extras_usb_db_usb_db_CPPFLAGS = $(AM_CPPFLAGS) -DUSB_DATABASE=\"$(USB_DATABASE)\" -DBUILD_FOR_USB
480
extras_usb_db_usb_db_CPPFLAGS = $(AM_CPPFLAGS) -DUSB_DATABASE=\"$(USB_DATABASE)\" -DBUILD_FOR_USB
481
extras_usb_db_usb_db_LDADD = libudev/libudev-private.la
481
extras_usb_db_usb_db_LDADD = libudev/libudev-private.la -lz
482
libexec_PROGRAMS += extras/usb-db/usb-db
482
libexec_PROGRAMS += extras/usb-db/usb-db
483
483
484
# ------------------------------------------------------------------------------
484
# ------------------------------------------------------------------------------
Lines 486-492 Link Here
486
# ------------------------------------------------------------------------------
486
# ------------------------------------------------------------------------------
487
extras_usb_db_pci_db_SOURCES = extras/usb-db/usb-db.c
487
extras_usb_db_pci_db_SOURCES = extras/usb-db/usb-db.c
488
extras_usb_db_pci_db_CPPFLAGS = $(AM_CPPFLAGS) -DPCI_DATABASE=\"$(PCI_DATABASE)\" -DBUILD_FOR_PCI
488
extras_usb_db_pci_db_CPPFLAGS = $(AM_CPPFLAGS) -DPCI_DATABASE=\"$(PCI_DATABASE)\" -DBUILD_FOR_PCI
489
extras_usb_db_pci_db_LDADD = libudev/libudev-private.la
489
extras_usb_db_pci_db_LDADD = libudev/libudev-private.la -lz
490
libexec_PROGRAMS += extras/usb-db/pci-db
490
libexec_PROGRAMS += extras/usb-db/pci-db
491
491
492
# ------------------------------------------------------------------------------
492
# ------------------------------------------------------------------------------
(-)udev-164.orig/Makefile.in (-2 / +2 lines)
Lines 1002-1015 Link Here
1002
# ------------------------------------------------------------------------------
1002
# ------------------------------------------------------------------------------
1003
@ENABLE_EXTRAS_TRUE@extras_usb_db_usb_db_SOURCES = extras/usb-db/usb-db.c
1003
@ENABLE_EXTRAS_TRUE@extras_usb_db_usb_db_SOURCES = extras/usb-db/usb-db.c
1004
@ENABLE_EXTRAS_TRUE@extras_usb_db_usb_db_CPPFLAGS = $(AM_CPPFLAGS) -DUSB_DATABASE=\"$(USB_DATABASE)\" -DBUILD_FOR_USB
1004
@ENABLE_EXTRAS_TRUE@extras_usb_db_usb_db_CPPFLAGS = $(AM_CPPFLAGS) -DUSB_DATABASE=\"$(USB_DATABASE)\" -DBUILD_FOR_USB
1005
@ENABLE_EXTRAS_TRUE@extras_usb_db_usb_db_LDADD = libudev/libudev-private.la
1005
@ENABLE_EXTRAS_TRUE@extras_usb_db_usb_db_LDADD = libudev/libudev-private.la -lz
1006
1006
1007
# ------------------------------------------------------------------------------
1007
# ------------------------------------------------------------------------------
1008
# pci-db - read PCI vendor/device string database
1008
# pci-db - read PCI vendor/device string database
1009
# ------------------------------------------------------------------------------
1009
# ------------------------------------------------------------------------------
1010
@ENABLE_EXTRAS_TRUE@extras_usb_db_pci_db_SOURCES = extras/usb-db/usb-db.c
1010
@ENABLE_EXTRAS_TRUE@extras_usb_db_pci_db_SOURCES = extras/usb-db/usb-db.c
1011
@ENABLE_EXTRAS_TRUE@extras_usb_db_pci_db_CPPFLAGS = $(AM_CPPFLAGS) -DPCI_DATABASE=\"$(PCI_DATABASE)\" -DBUILD_FOR_PCI
1011
@ENABLE_EXTRAS_TRUE@extras_usb_db_pci_db_CPPFLAGS = $(AM_CPPFLAGS) -DPCI_DATABASE=\"$(PCI_DATABASE)\" -DBUILD_FOR_PCI
1012
@ENABLE_EXTRAS_TRUE@extras_usb_db_pci_db_LDADD = libudev/libudev-private.la
1012
@ENABLE_EXTRAS_TRUE@extras_usb_db_pci_db_LDADD = libudev/libudev-private.la -lz
1013
1013
1014
# ------------------------------------------------------------------------------
1014
# ------------------------------------------------------------------------------
1015
# mobile-action-modeswitch - switch Mobile Action cables into serial mode
1015
# mobile-action-modeswitch - switch Mobile Action cables into serial mode

Return to bug 360849