| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 
 | Description: Correct calculation of block count
 Makes sure equal numbers of blocks are return with applying 'stat *' on
 the mounted iso, regardless of whether it has been mounted per
 'mount -o loop ...', 'udisksctl loop-setup ...' or 'fuseiso ...'.
Author: Gareth Davidson <garethdavidson@gmail.com>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1104465
Forwarded: not-needed
Reviewed-by: Sven Geuer <sge@debian.org>
Last-Update: 2025-05-01
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
diff --git a/src/isofs.c b/src/isofs.c
index 64b1e92..d53139c 100644
--- a/src/isofs.c
+++ b/src/isofs.c
@@ -539,7 +539,7 @@ static int isofs_direntry2stat(struct stat *st, isofs_inode *inode) {
         st->st_size = isonum_733(record->size);
     };
     
-    st->st_blocks = st->st_size / context.data_size; // should not be to meaningful even for zisofs compression
+    st->st_blocks = (st->st_size + 511) >> 9; // divide by 512 with ceil
     st->st_blksize = context.data_size;
     st->st_nlink = 1; // always, even if rrip PX entry found
     
 |