From ab3337e4f6a3e0f1c5587890520d0e5bb4ad9569 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Wed, 18 May 2011 15:11:42 +0300 Subject: [PATCH] Eliminate dead cpio_copy() + related stuff - These code-paths cannot have been hit since readRPM() was killed, mop out the leftovers --- build/pack.c | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/build/pack.c b/build/pack.c index 84960f8..5a263ca 100644 --- a/build/pack.c +++ b/build/pack.c @@ -28,7 +28,6 @@ typedef struct cpioSourceArchive_s { rpm_loff_t cpioArchiveSize; - FD_t cpioFdIn; rpmfi cpioList; } * CSA_t; @@ -85,29 +84,6 @@ static rpmRC cpio_doio(FD_t fdo, Header h, CSA_t csa, const char * fmodeMacro) return rc; } -/** - */ -static rpmRC cpio_copy(FD_t fdo, CSA_t csa) -{ - char buf[BUFSIZ]; - size_t nb; - - while((nb = Fread(buf, sizeof(buf[0]), sizeof(buf), csa->cpioFdIn)) > 0) { - if (Fwrite(buf, sizeof(buf[0]), nb, fdo) != nb) { - rpmlog(RPMLOG_ERR, _("cpio_copy write failed: %s\n"), - Fstrerror(fdo)); - return RPMRC_FAIL; - } - csa->cpioArchiveSize += nb; - } - if (Ferror(csa->cpioFdIn)) { - rpmlog(RPMLOG_ERR, _("cpio_copy read failed: %s\n"), - Fstrerror(csa->cpioFdIn)); - return RPMRC_FAIL; - } - return RPMRC_OK; -} - static rpmRC addFileToTag(rpmSpec spec, const char * file, Header h, rpmTagVal tag, int append) { @@ -346,8 +322,6 @@ static rpmRC writeRPM(Header *hdrp, unsigned char ** pkgidp, const char *fileNam fdFiniDigest(fd, PGPHASHALGO_SHA1, (void **)&SHA1, NULL, 1); if (csa->cpioList != NULL) { rc = cpio_doio(fd, h, csa, rpmio_flags); - } else if (Fileno(csa->cpioFdIn) >= 0) { - rc = cpio_copy(fd, csa); } else { rc = RPMRC_FAIL; rpmlog(RPMLOG_ERR, _("Bad CSA data\n")); @@ -677,12 +651,10 @@ rpmRC packageBinaries(rpmSpec spec, const char *cookie, int cheating) memset(csa, 0, sizeof(*csa)); csa->cpioArchiveSize = 0; - csa->cpioFdIn = fdNew(); csa->cpioList = rpmfiLink(pkg->cpioList); rc = writeRPM(&pkg->header, NULL, fn, csa, NULL); csa->cpioList = rpmfiFree(csa->cpioList); - csa->cpioFdIn = fdFree(csa->cpioFdIn); if (rc == RPMRC_OK) { /* Do check each written package if enabled */ char *pkgcheck = rpmExpand("%{?_build_pkgcheck} ", fn, NULL); @@ -730,7 +702,6 @@ rpmRC packageSources(rpmSpec spec, char **cookie) memset(csa, 0, sizeof(*csa)); csa->cpioArchiveSize = 0; - csa->cpioFdIn = fdNew(); csa->cpioList = rpmfiLink(spec->sourceCpioList); spec->sourcePkgId = NULL; @@ -742,7 +713,6 @@ rpmRC packageSources(rpmSpec spec, char **cookie) } csa->cpioList = rpmfiFree(csa->cpioList); - csa->cpioFdIn = fdFree(csa->cpioFdIn); pkgcheck = _free(pkgcheck); fn = _free(fn); } -- 2.7.4