Am 04.02.2013 um 22:23 schrieb Adrian Knoth: Hi Adrian,
I've just noticed that upstream decided to divide by 1024 in newer versions of src/fsio.c: /* In order to return a size in KB, as get_fs_size() does, we need * to divide by 1024. */ *fs_size = (((off_t) fs.f_bavail * (off_t) fs.f_frsize) / 1024); So they're effectively hiding the bug.
Fixed bug by that change: http://bugs.proftpd.org/show_bug.cgi?id=3626
I suggest to at least put a comment before pr_fs_getsize2 that the returned number is in KB, not in bytes.
Current code in 1.3.5b: /* Note: The size provided by pr_fs_getsize2() is in KB, not bytes. */ static void format_size_str(char *buf, size_t buflen, off_t size) { char *units[] = {"K", "M", "G", "T", "P"}; unsigned int nunits = 5; register unsigned int i = 0; int res; /* Determine the appropriate units label to use. */ while (size > 1024 && i < nunits) { pr_signals_handle(); size /= 1024; i++; } and for int pr_fs_getsize2() from fsio.c. /* Returns the size in KB via the `fs_size' argument. */ int pr_fs_getsize2(char *path, off_t *fs_size) { return fs_getsize(-1, path, fs_size); } Is that sufficient for you or should be forward that bug to upstream anyway? Hilmar -- http://www.hilmar-preusse.de.vu/ #206401 http://counter.li.org