Fix compression/hash table traversal - dedup - deduplicating backup program HTML git clone git://bitreich.org/dedup/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/dedup/ DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit 02946681b92b707c62ae39ec02630a380f5ad0f0 DIR parent 54776ab6b2b26aea19f77b7876e80cff4b602913 HTML Author: sin <sin@2f30.org> Date: Thu, 25 Apr 2019 13:45:04 +0100 Fix compression/hash table traversal Diffstat: M bstorage.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) --- DIR diff --git a/bstorage.c b/bstorage.c @@ -321,7 +321,7 @@ bscreat(struct bctx *bctx, char *path, int mode, struct bparam *bpar) bhdr->flags = (VMAJ << VMAJSHIFT) | VMIN; /* Set compression algorithm */ - for (algo = ctbl; algo; algo++) { + for (algo = ctbl; *algo; algo++) { if (strcmp(*algo, bpar->calgo) == 0) { uint64_t v; @@ -330,14 +330,14 @@ bscreat(struct bctx *bctx, char *path, int mode, struct bparam *bpar) break; } } - if (algo == NULL) { + if (*algo == NULL) { free(sctx); close(fd); return -1; } /* Set hash algorithm */ - for (algo = htbl; algo; algo++) { + for (algo = htbl; *algo; algo++) { if (strcmp(*algo, bpar->halgo) == 0) { uint64_t v; @@ -346,7 +346,7 @@ bscreat(struct bctx *bctx, char *path, int mode, struct bparam *bpar) break; } } - if (algo == NULL) { + if (*algo == NULL) { free(sctx); close(fd); return -1; @@ -400,7 +400,7 @@ bsopen(struct bctx *bctx, char *path, int flags, int mode, struct bparam *bpar) /* Get compression algorithm */ calgo = (bhdr->flags >> CALGOSHIFT) & CALGOMASK; - for (algo = ctbl; algo; algo++) { + for (algo = ctbl; *algo; algo++) { uint64_t v = algo - ctbl; if (v == calgo) { @@ -408,7 +408,7 @@ bsopen(struct bctx *bctx, char *path, int flags, int mode, struct bparam *bpar) break; } } - if (algo == NULL) { + if (*algo == NULL) { free(sctx); close(fd); return -1; @@ -416,7 +416,7 @@ bsopen(struct bctx *bctx, char *path, int flags, int mode, struct bparam *bpar) /* Get hash algorithm */ halgo = (bhdr->flags >> CALGOSHIFT) & CALGOMASK; - for (algo = htbl; algo; algo++) { + for (algo = htbl; *algo; algo++) { uint64_t v = algo - htbl; if (v == halgo) { @@ -424,7 +424,7 @@ bsopen(struct bctx *bctx, char *path, int flags, int mode, struct bparam *bpar) break; } } - if (algo == NULL) { + if (*algo == NULL) { free(sctx); close(fd); return -1;