Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 267563 Details for
Bug 360849
sys-fs/udev does not support reading compressed hardware databases
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
zlib support
udev-164-compression_support.patch (text/plain), 4.00 KB, created by
Samuli Suominen (RETIRED)
on 2011-03-28 16:47:43 UTC
(
hide
)
Description:
zlib support
Filename:
MIME Type:
Creator:
Samuli Suominen (RETIRED)
Created:
2011-03-28 16:47:43 UTC
Size:
4.00 KB
patch
obsolete
>diff -ur udev-164.orig/extras/usb-db/usb-db.c udev-164/extras/usb-db/usb-db.c >--- udev-164.orig/extras/usb-db/usb-db.c 2010-04-12 17:06:59.000000000 +0300 >+++ udev-164/extras/usb-db/usb-db.c 2011-03-28 19:39:06.000000000 +0300 >@@ -37,6 +37,12 @@ > # error "Are you havin' a laugh?" > #endif > >+#include <zlib.h> >+#define data_file gzFile >+#define data_fopen(path, mode) gzopen(path, mode) >+#define data_fgets(s, size, stream) gzgets(stream, s, size) >+#define data_close(f) gzclose(f) >+ > static int get_id_attr( > struct udev_device *parent, > const char *name, >@@ -96,29 +102,30 @@ > char **vendor, > char **product) { > >- FILE *f; >+ data_file f; > int ret = -1; > int found_vendor = 0; >- char *line = NULL; >+ char buf[512], *line; >+ char *filename = DATABASE ; > > *vendor = *product = NULL; > >- if (!(f = fopen(DATABASE, "r"))) { >- fprintf(stderr, "Failed to open database file "DATABASE": %s\n", strerror(errno)); >+ filename = DATABASE".gz"; >+ if (!(f = data_fopen(filename, "r"))) { >+ filename = DATABASE; >+ if (!(f = data_fopen(filename, "r"))) { >+ fprintf(stderr, "Failed to open database file "DATABASE": %s\n", strerror(errno)); > return -1; >- } >+ } >+ } > > for (;;) { > size_t n; > >- if (line) { >- free(line); >- line = NULL; >- } >- >- if (getline(&line, &n, f) < 0) >+ if (data_fgets(buf, sizeof(buf), f) < 0) > break; > >+ line = buf; > rstrip(line); > > if (line[0] == '#' || line[0] == 0) >@@ -169,8 +176,7 @@ > ret = 0; > > finish: >- free(line); >- fclose(f); >+ data_close(f); > > if (ret < 0) { > free(*product); >diff -ur udev-164.orig/Makefile.am udev-164/Makefile.am >--- udev-164.orig/Makefile.am 2010-10-22 14:56:16.000000000 +0300 >+++ udev-164/Makefile.am 2011-03-28 19:41:19.000000000 +0300 >@@ -478,7 +478,7 @@ > # ------------------------------------------------------------------------------ > extras_usb_db_usb_db_SOURCES = extras/usb-db/usb-db.c > extras_usb_db_usb_db_CPPFLAGS = $(AM_CPPFLAGS) -DUSB_DATABASE=\"$(USB_DATABASE)\" -DBUILD_FOR_USB >-extras_usb_db_usb_db_LDADD = libudev/libudev-private.la >+extras_usb_db_usb_db_LDADD = libudev/libudev-private.la -lz > libexec_PROGRAMS += extras/usb-db/usb-db > > # ------------------------------------------------------------------------------ >@@ -486,7 +486,7 @@ > # ------------------------------------------------------------------------------ > extras_usb_db_pci_db_SOURCES = extras/usb-db/usb-db.c > extras_usb_db_pci_db_CPPFLAGS = $(AM_CPPFLAGS) -DPCI_DATABASE=\"$(PCI_DATABASE)\" -DBUILD_FOR_PCI >-extras_usb_db_pci_db_LDADD = libudev/libudev-private.la >+extras_usb_db_pci_db_LDADD = libudev/libudev-private.la -lz > libexec_PROGRAMS += extras/usb-db/pci-db > > # ------------------------------------------------------------------------------ >diff -ur udev-164.orig/Makefile.in udev-164/Makefile.in >--- udev-164.orig/Makefile.in 2010-10-23 16:14:21.000000000 +0300 >+++ udev-164/Makefile.in 2011-03-28 19:41:39.000000000 +0300 >@@ -1002,14 +1002,14 @@ > # ------------------------------------------------------------------------------ > @ENABLE_EXTRAS_TRUE@extras_usb_db_usb_db_SOURCES = extras/usb-db/usb-db.c > @ENABLE_EXTRAS_TRUE@extras_usb_db_usb_db_CPPFLAGS = $(AM_CPPFLAGS) -DUSB_DATABASE=\"$(USB_DATABASE)\" -DBUILD_FOR_USB >-@ENABLE_EXTRAS_TRUE@extras_usb_db_usb_db_LDADD = libudev/libudev-private.la >+@ENABLE_EXTRAS_TRUE@extras_usb_db_usb_db_LDADD = libudev/libudev-private.la -lz > > # ------------------------------------------------------------------------------ > # pci-db - read PCI vendor/device string database > # ------------------------------------------------------------------------------ > @ENABLE_EXTRAS_TRUE@extras_usb_db_pci_db_SOURCES = extras/usb-db/usb-db.c > @ENABLE_EXTRAS_TRUE@extras_usb_db_pci_db_CPPFLAGS = $(AM_CPPFLAGS) -DPCI_DATABASE=\"$(PCI_DATABASE)\" -DBUILD_FOR_PCI >-@ENABLE_EXTRAS_TRUE@extras_usb_db_pci_db_LDADD = libudev/libudev-private.la >+@ENABLE_EXTRAS_TRUE@extras_usb_db_pci_db_LDADD = libudev/libudev-private.la -lz > > # ------------------------------------------------------------------------------ > # mobile-action-modeswitch - switch Mobile Action cables into serial mode
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 360849
: 267563 |
295319