]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Reshuffle conditions to ensure path is initialised and NULL handled.
authorJoerg Sonnenberger <joerg@bec.de>
Sat, 29 Apr 2017 13:39:37 +0000 (15:39 +0200)
committerJoerg Sonnenberger <joerg@bec.de>
Sat, 29 Apr 2017 13:39:37 +0000 (15:39 +0200)
libarchive/archive_read_disk_entry_from_file.c

index 700f9e3ae1af5fd379edc499e686dbaa7f0a0c31..548ba89ef3db4406dbedc1719a4f6097c592261e 100644 (file)
@@ -928,11 +928,10 @@ setup_sparse(struct archive_read_disk *a,
                return (ARCHIVE_OK);
 
        /* Does filesystem support the reporting of hole ? */
-       if (*fd < 0) {
+       if (*fd < 0)
                path = archive_read_disk_entry_setup_path(a, entry, fd);
-               if (path == NULL)
-                       return (ARCHIVE_FAILED);
-       }
+       else
+               path = NULL;
 
        if (*fd >= 0) {
 #ifdef _PC_MIN_HOLE_SIZE
@@ -943,6 +942,8 @@ setup_sparse(struct archive_read_disk *a,
                if (initial_off != 0)
                        lseek(*fd, 0, SEEK_SET);
        } else {
+               if (path == NULL)
+                       return (ARCHIVE_FAILED);
 #ifdef _PC_MIN_HOLE_SIZE
                if (pathconf(path, _PC_MIN_HOLE_SIZE) <= 0)
                        return (ARCHIVE_OK);