]> git.ipfire.org Git - pakfire.git/commitdiff
archive: read: Correctly fail if we cannot find a file
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 24 Mar 2023 16:17:22 +0000 (16:17 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 24 Mar 2023 16:17:22 +0000 (16:17 +0000)
The routine did not properly clear up the cookie after it could not find
a file in the archive.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/archive.c

index ff83af82315bb47b3e3ec0c2c0d3d3991b8878bc..34d1f98696e81cb2946d6e9dd85d1cd9ba1d5856 100644 (file)
@@ -692,10 +692,11 @@ PAKFIRE_EXPORT FILE* pakfire_archive_read(struct pakfire_archive* archive, const
 
        // Nothing found
        if (!f) {
+               ERROR(archive->pakfire, "Could not find /%s\n", path);
+
                // No such file or directory
                errno = ENOENT;
-
-               ERROR(archive->pakfire, "Could not find /%s: %m\n", path);
+               goto ERROR;
        }
 
        return f;