commit d3ec97d4abc70c1e5c87f5ff5f7b4800fdf89bcb
parent 6fa8f387de8c032029f8a3e9994d5ac5be5c7670
Author: sin <sin@2f30.org>
Date: Mon, 25 Feb 2019 11:46:30 +0000
Print error when trying to extract an unknown snapshot id
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/dedup.c b/dedup.c
@@ -28,6 +28,7 @@ enum {
struct extract_args {
uint8_t *md;
int fd;
+ int ret;
};
static struct snapshot_hdr snaphdr;
@@ -305,6 +306,7 @@ extract(struct snapshot *snap, void *arg)
}
free_buf(buf[1]);
free_buf(buf[0]);
+ args->ret = 0;
return WALK_STOP;
}
@@ -601,7 +603,10 @@ main(int argc, char *argv[])
str2bin(id, md);
args.md = md;
args.fd = fd;
+ args.ret = -1;
walk_snap(extract, &args);
+ if (args.ret != 0)
+ errx(1, "unknown snapshot: %s", id);
} else {
dedup(fd, msg);
}