If fallocate(2) fails do our best to recover - dedup - deduplicating backup program
 (HTM) git clone git://bitreich.org/dedup/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/dedup/
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Tags
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 00d03339c89087d34d11f3147daae28de6f94c7a
 (DIR) parent d6e4ca0475985f2f98e35fcfd5bdb3b4304a0eff
 (HTM) Author: sin <sin@2f30.org>
       Date:   Thu, 25 Apr 2019 22:08:08 +0100
       
       If fallocate(2) fails do our best to recover
       
       Diffstat:
         M bstorage.c                          |       8 +++++++-
       
       1 file changed, 7 insertions(+), 1 deletion(-)
       ---
 (DIR) diff --git a/bstorage.c b/bstorage.c
       @@ -567,7 +567,13 @@ bsrm(struct bctx *bctx, unsigned char *md)
                        int mode;
        
                        mode = FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE;
       -                fallocate(sctx->fd, mode, bd->offset, bd->size);
       +                if (fallocate(sctx->fd, mode, bd->offset, bd->size) < 0) {
       +                        lseek(sctx->fd, bdoffs, SEEK_SET);
       +                        bd->refcnt++;
       +                        packbd(sctx->fd, bd);
       +                        return -1;
       +                }
       +
                        RB_REMOVE(bdcache, &sctx->bdcache, bd);
                        free(bd);
                }