commit 1b1447f899bb2dc4b78ec0b915c71343009ca9c5
parent 1ba4afc35229c3ea9fcb421dfcde63d87a39f227
Author: sin <sin@2f30.org>
Date: Sat, 9 Mar 2019 21:58:03 +0000
seek inside walk_snap()
It is less error prone to do it this way.
Diffstat:
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/dedup.c b/dedup.c
@@ -377,6 +377,7 @@ walk_snap(int (*fn)(struct snapshot *, void *), void *arg)
{
uint64_t i;
+ xlseek(ifd, SNAP_HDR_SIZE, SEEK_SET);
for (i = 0; i < snap_hdr.nr_snapshots; i++) {
struct snapshot *snap;
int ret;
@@ -588,7 +589,6 @@ main(int argc, char *argv[])
if (cflag) {
int ret;
- xlseek(ifd, SNAP_HDR_SIZE, SEEK_SET);
ret = 0;
walk_snap(check_snap, &ret);
if (ret != 0)
@@ -599,7 +599,6 @@ main(int argc, char *argv[])
}
if (lflag) {
- xlseek(ifd, SNAP_HDR_SIZE, SEEK_SET);
walk_snap(list, NULL);
term();
return 0;
@@ -608,7 +607,6 @@ main(int argc, char *argv[])
if (id) {
struct extract_args args;
- xlseek(ifd, SNAP_HDR_SIZE, SEEK_SET);
str2bin(id, md);
args.md = md;
args.fd = fd;