Skip to content

Commit 31de69d

Browse files
authored
Fix statfs under NODERAWFS + ASSERTIONS=2 (#24756)
Fixes: #24729
1 parent a163723 commit 31de69d

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/lib/libnoderawfs.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,18 @@ addToLibrary({
8484
var stream = FS.getStreamChecked(fd);
8585
return fs.fstatSync(stream.nfd);
8686
},
87-
statfsStream(stream) {
88-
return fs.statfsSync(stream.path);
87+
statfs(path) {
88+
// Node's fs.statfsSync API doesn't provide these attributes so include
89+
// some defaults.
90+
var defaults = {
91+
fsid: 42,
92+
flags: 2,
93+
namelen: 255,
94+
}
95+
return Object.assign(defaults, fs.statfsSync(path));
8996
},
90-
statfsNode(node) {
91-
return fs.statfsSync(node.path);
97+
statfsStream(stream) {
98+
return FS.statfs(stream.path);
9299
},
93100
chmod(path, mode, dontFollow) {
94101
mode &= {{{ cDefs.S_IALLUGO }}};

test/test_other.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14426,7 +14426,7 @@ def test_unistd_sleep(self):
1442614426
def test_unistd_fstatfs(self):
1442714427
if '-DNODERAWFS' in self.cflags and WINDOWS:
1442814428
self.skipTest('Cannot look up /dev/stdout on windows')
14429-
self.do_run_in_out_file_test('unistd/fstatfs.c')
14429+
self.do_run_in_out_file_test('unistd/fstatfs.c', cflags=['-sASSERTIONS=2'])
1443014430

1443114431
@no_windows("test is Linux-specific")
1443214432
@no_mac("test is Linux-specific")

0 commit comments

Comments
 (0)