tPrint error when trying to extract an unknown snapshot id - dedup - deduplicating backup program
(HTM) git clone git://git.z3bra.org/dedup.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit d3ec97d4abc70c1e5c87f5ff5f7b4800fdf89bcb
(DIR) parent 6fa8f387de8c032029f8a3e9994d5ac5be5c7670
(HTM) 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:
M dedup.c | 5 +++++
1 file changed, 5 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/dedup.c b/dedup.c
t@@ -28,6 +28,7 @@ enum {
struct extract_args {
uint8_t *md;
int fd;
+ int ret;
};
static struct snapshot_hdr snaphdr;
t@@ -305,6 +306,7 @@ extract(struct snapshot *snap, void *arg)
}
free_buf(buf[1]);
free_buf(buf[0]);
+ args->ret = 0;
return WALK_STOP;
}
t@@ -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);
}