From 099d00de3b59052800b4e78665ccafc896d7cbc4 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Sat, 19 Apr 2008 17:09:43 +0300 Subject: [PATCH] Avoid entirely silly rpmio FD_t use in processPackageFiles() - since we just convert it to FILE anyway, no much point in using Fopen() then - additionally remember to close the file if expandMacros() fails --- build/files.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/build/files.c b/build/files.c index b0051b2..f8b25e6 100644 --- a/build/files.c +++ b/build/files.c @@ -1758,8 +1758,7 @@ static rpmRC processPackageFiles(rpmSpec spec, Package pkg, if (pkg->fileFile) { char *ffn; - FILE * f; - FD_t fd; + FILE *fd; /* XXX W2DO? urlPath might be useful here. */ if (*pkg->fileFile == '/') { @@ -1770,27 +1769,24 @@ static rpmRC processPackageFiles(rpmSpec spec, Package pkg, (spec->buildSubdir ? spec->buildSubdir : "") , "/", pkg->fileFile, NULL); } - fd = Fopen(ffn, "r.fpio"); + fd = fopen(ffn, "r"); - if (fd == NULL || Ferror(fd)) { - rpmlog(RPMLOG_ERR, - _("Could not open %%files file %s: %s\n"), - ffn, Fstrerror(fd)); + if (fd == NULL || ferror(fd)) { + rpmlog(RPMLOG_ERR, _("Could not open %%files file %s: %m\n"), ffn); return RPMRC_FAIL; } ffn = _free(ffn); - f = fdGetFILE(fd); - if (f != NULL) - while (fgets(buf, sizeof(buf), f)) { + while (fgets(buf, sizeof(buf), fd)) { handleComments(buf); if (expandMacros(spec, spec->macros, buf, sizeof(buf))) { rpmlog(RPMLOG_ERR, _("line: %s\n"), buf); + fclose(fd); return RPMRC_FAIL; } appendStringBuf(pkg->fileList, buf); } - (void) Fclose(fd); + (void) fclose(fd); } /* Init the file list structure */ -- 2.7.4