Commit 286fcbb
committed
fix(API): prefer frsize over bsize for disk-space calculation
Defensive fix from bugbot review of #1627. Node's fs.statfs() currently
only exposes bsize (libuv's uv_statfs_t doesn't copy frsize from the
underlying statfs(2) syscall), and on Linux+ext4 'blocks * bsize'
matches 'df -B1' byte-exactly. But POSIX statvfs denominates blocks in
frsize, not bsize, and on exotic filesystems (e.g. VirtioFS on Docker)
the two can differ. Using 'stats.frsize ?? stats.bsize' is a zero-cost
hedge that automatically picks up frsize if a future Node version or a
polyfill exposes it, while keeping today's behavior unchanged on every
mainstream environment.1 parent e6d4396 commit 286fcbb
1 file changed
Lines changed: 11 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
64 | 73 | | |
65 | 74 | | |
66 | | - | |
67 | | - | |
| 75 | + | |
| 76 | + | |
68 | 77 | | |
69 | 78 | | |
70 | 79 | | |
| |||
0 commit comments