]> mj.ucw.cz Git - pciutils.git/commitdiff
Fixed a bug in displaying of zlib errors.
authorMartin Mares <mj@ucw.cz>
Mon, 11 Feb 2008 16:07:32 +0000 (17:07 +0100)
committerMartin Mares <mj@ucw.cz>
Mon, 11 Feb 2008 16:07:32 +0000 (17:07 +0100)
ChangeLog
lib/names.c

index 8165ee6952c357eb3faac143b5584821beef5672..20df7a62cd4287fca2c26f01b9519b2a3298a5ae 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-02-11  Martin Mares <mj@ucw.cz>
+
+       * lib/names.c: Fix displaying of errors reported by zlib.
+       Previously, the buffer containing the error message had
+       been deallocated by gzclose() before the message was printed.
+
 2008-01-07  Martin Mares <mj@ucw.cz>
 
        * update-pciids.sh: Added quiet mode (-q). Clean up uncompressed
index eee2f19b6edbb3cc82b3d388480a790cbab1fa3e..64b5c27a8e7a3f313ad3ec037830382391b646d5 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     The PCI Library -- ID to Name Translation
  *
- *     Copyright (c) 1997--2007 Martin Mares <mj@ucw.cz>
+ *     Copyright (c) 1997--2008 Martin Mares <mj@ucw.cz>
  *
  *     Can be freely distributed and used under the terms of the GNU GPL.
  */
@@ -43,9 +43,10 @@ static pci_file pci_open(struct pci_access *a)
 #define PCI_ERROR(f, err)                                              \
        if (!err) {                                                     \
                int errnum;                                             \
-               err = gzerror(f, &errnum);                              \
-               if (errnum == Z_ERRNO)  err = "I/O error";              \
-               else if (errnum >= 0)   err = NULL;                     \
+               gzerror(f, &errnum);                                    \
+               if (errnum >= 0) err = NULL;                            \
+               else if (errnum == Z_ERRNO) err = "I/O error";          \
+               else err = zError(errnum);                              \
        }
 #else
 typedef FILE * pci_file;