Avoid entirely silly rpmio FD_t use in processPackageFiles()
authorPanu Matilainen <pmatilai@redhat.com>
Sat, 19 Apr 2008 14:09:43 +0000 (17:09 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Sat, 19 Apr 2008 14:09:43 +0000 (17:09 +0300)
- 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

index b0051b2..f8b25e6 100644 (file)
@@ -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 */