From: Martin Mares Date: Mon, 11 Feb 2008 16:07:32 +0000 (+0100) Subject: Fixed a bug in displaying of zlib errors. X-Git-Tag: v3.0.0~5^2 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=0fc3bd182e16ef33ea6a53e65728782f8a5ba6c8;p=pciutils.git Fixed a bug in displaying of zlib errors. --- diff --git a/ChangeLog b/ChangeLog index 8165ee6..20df7a6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-02-11 Martin Mares + + * 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 * update-pciids.sh: Added quiet mode (-q). Clean up uncompressed diff --git a/lib/names.c b/lib/names.c index eee2f19..64b5c27 100644 --- a/lib/names.c +++ b/lib/names.c @@ -1,7 +1,7 @@ /* * The PCI Library -- ID to Name Translation * - * Copyright (c) 1997--2007 Martin Mares + * Copyright (c) 1997--2008 Martin Mares * * 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;