URI: 
       Use fstat to get the size of the file - 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 d44390527612ca94178f33bd6ce15d999c7cd220
   DIR parent 705d45cf7f4bf7006081d44dc0a6439ec90dcede
  HTML Author: sin <sin@2f30.org>
       Date:   Wed, 21 Mar 2018 17:33:20 +0000
       
       Use fstat to get the size of the file
       
       Diffstat:
         M dedup.c                             |      14 +++++++++++---
       
       1 file changed, 11 insertions(+), 3 deletions(-)
       ---
   DIR diff --git a/dedup.c b/dedup.c
       @@ -232,13 +232,21 @@ grow_ent(struct ent *ent, uint64_t nblks)
        uint64_t
        storefile_nblks(void)
        {
       -        return lseek(sfd, 0, SEEK_END) / sizeof(struct blk);
       +        struct stat sb;
       +
       +        if (fstat(sfd, &sb) == -1)
       +                err(1, "fstat");
       +        return sb.st_size /  sizeof(struct blk);
        }
        
        uint64_t
        cachefile_nblks(void)
        {
       -        return lseek(cfd, 0, SEEK_END) / sizeof(struct cache_data);
       +        struct stat sb;
       +
       +        if (fstat(cfd, &sb) == -1)
       +                err(1, "fstat");
       +        return sb.st_size /  sizeof(struct cache_data);
        }
        
        void
       @@ -495,7 +503,7 @@ init(void)
                        err(1, "open %s", CACHEF);
        
                if (fstat(ifd, &sb) == -1)
       -                err(1, "stat %s", INDEXF);
       +                err(1, "fstat %s", INDEXF);
                if (sb.st_size != 0)
                        xread(ifd, &enthdr, sizeof(enthdr));