dedup

deduplicating backup program
git clone git://git.2f30.org/dedup
Log | Files | Refs | README | LICENSE

commit 02946681b92b707c62ae39ec02630a380f5ad0f0
parent 54776ab6b2b26aea19f77b7876e80cff4b602913
Author: sin <sin@2f30.org>
Date:   Thu, 25 Apr 2019 13:45:04 +0100

Fix compression/hash table traversal

Diffstat:
Mbstorage.c | 16++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

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;