diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-07-25 14:16:10 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-07-25 14:20:48 +0200 |
commit | f8346498604f417415c131e3c6dbf66e6643254e (patch) | |
tree | 8f9de79c9d4d59bfa9481a632064afde5afa2d39 /lib/sqfs/read_super.c | |
parent | db9187c8d21e9f08b20899e3e14c1938db7b79fb (diff) |
Replace reads in squashfs with positional reads
In most cases, we know exactely where the data that we want to read is
on disk, so instead of using read() on the squashfs (or lseek + read),
the code can in many places be cleaned up to use the pread wrapper
read_data_at instead.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/read_super.c')
-rw-r--r-- | lib/sqfs/read_super.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/lib/sqfs/read_super.c b/lib/sqfs/read_super.c index 1a84ff9..fff3d50 100644 --- a/lib/sqfs/read_super.c +++ b/lib/sqfs/read_super.c @@ -15,10 +15,7 @@ int sqfs_super_read(sqfs_super_t *super, int fd) sqfs_super_t temp; int i; - if (lseek(fd, 0, SEEK_SET) == (off_t)-1) - goto fail_seek; - - if (read_data("reading super block", fd, &temp, sizeof(temp))) + if (read_data_at("reading super block", 0, fd, &temp, sizeof(temp))) return -1; temp.magic = le32toh(temp.magic); @@ -87,7 +84,4 @@ int sqfs_super_read(sqfs_super_t *super, int fd) memcpy(super, &temp, sizeof(temp)); return 0; -fail_seek: - perror("squashfs writing super block: seek on output file"); - return -1; } |