• src/xpdev/dirwrap.c

    From Rob Swindell (on Debian Linux)@1:103/705 to Git commit to main/sbbs/master on Saturday, November 14, 2026 10:01:38
    https://gitlab.synchro.net/main/sbbs/-/commit/9792e4b5c880008a33a70ecf
    Modified Files:
    src/xpdev/dirwrap.c
    Log Message:
    Fix getfreediskspace()/getdisksize() on Unix for units larger than 1

    The Unix (statfs and statvfs) branches of getdiskspace() divided the block count by the requested unit before multiplying by the block size. With a
    4 KiB block size that made any unit of 1 GiB or more return 0 unless at
    least 4 TiB was free (e.g. @FREESPACEG@ showed 0 with 574 GB free), and
    rounded K and M results down to a multiple of the block size.

    Compute the byte total first, then divide by the unit, as the Windows
    branch already does.

    Affected callers include @FREESPACEK/M/G/T@, JS disk_free()/disk_size()
    and system.freediskspacek, the umonitor free space display, and the
    SBBSecho minimum free space check. Callers passing a unit of 1 were
    unaffected.

    Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
    --- SBBSecho 3.38-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)