]> wimlib.net Git - wimlib/commitdiff
resource.c: Don't call lseek() if not necessary
authorEric Biggers <ebiggers3@gmail.com>
Tue, 27 May 2014 02:22:23 +0000 (21:22 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Tue, 27 May 2014 02:22:23 +0000 (21:22 -0500)
To be reading a pipable resource from a pipe, is_pipable must be set in
the 'struct wim_resource_spec', so check that first before calling
filedes_is_seekable().

src/resource.c

index 5c0225ab6d55023c5c8ef9c60bdda7b280fdc5ac..d2a4c3098327797cd1022b7989e144fb7d474bf8 100644 (file)
@@ -169,7 +169,7 @@ read_compressed_wim_resource(const struct wim_resource_spec * const rspec,
        struct filedes * const in_fd = &rspec->wim->in_fd;
 
        /* Determine if we're reading a pipable resource from a pipe or not.  */
-       const bool is_pipe_read = !filedes_is_seekable(in_fd);
+       const bool is_pipe_read = (rspec->is_pipable && !filedes_is_seekable(in_fd));
 
        /* Determine if the chunk table is in an altenate format.  */
        const bool alt_chunk_table = (rspec->flags & WIM_RESHDR_FLAG_PACKED_STREAMS)