From 9707b5478bbad7251810247b2383f91b5bbabc16 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Sat, 17 Oct 2009 12:15:29 +0300 Subject: Unbreak lzdio/xzdio - revert part of b0d1038190be5cb4b45e2c2c7c84ee7022164ba2 which broke the split-personality lzdio/xzdio --- rpmio/rpmio.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'rpmio') diff --git a/rpmio/rpmio.c b/rpmio/rpmio.c index e9306dd0d..6473d5577 100644 --- a/rpmio/rpmio.c +++ b/rpmio/rpmio.c @@ -1323,12 +1323,16 @@ static ssize_t lzwrite(LZFILE *lzfile, void *buf, size_t len) static void * lzdFileno(FD_t fd) { - return iotFileno(fd, lzdio); -} - -static void * xzdFileno(FD_t fd) -{ - return iotFileno(fd, xzdio); + void * rc = NULL; + FDSANE(fd); + for (int i = fd->nfps; i >= 0; i--) { + FDSTACK_t * fps = &fd->fps[i]; + if (fps->io != xzdio && fps->io != lzdio) + continue; + rc = fps->fp; + break; + } + return rc; } static FD_t xzdOpen(const char * path, const char * mode) @@ -1465,7 +1469,7 @@ DBGIO(fd, (stderr, "==>\tlzdClose(%p) rc %lx %s\n", cookie, (unsigned long)rc, f static struct FDIO_s xzdio_s = { lzdRead, lzdWrite, fdSeekNot, lzdClose, NULL, NULL, NULL, fdFileno, - NULL, xzdOpen, xzdFileno, lzdFlush + NULL, xzdOpen, lzdFileno, lzdFlush }; static const FDIO_t xzdio = &xzdio_s; -- cgit v1.2.3