Skip to content

Commit 7f4533e

Browse files
committed
Fix ftruncate
1 parent bebfc6b commit 7f4533e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/library_fs.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,9 @@ FS.staticInit();
10471047
});
10481048
},
10491049
ftruncate(fd, len) {
1050+
if (len < 0) {
1051+
throw new FS.ErrnoError({{{ cDefs.EINVAL }}});
1052+
}
10501053
var stream = FS.getStreamChecked(fd);
10511054
var node = stream.node;
10521055
if ((stream.flags & {{{ cDefs.O_ACCMODE }}}) === {{{ cDefs.O_RDONLY}}}) {

0 commit comments

Comments
 (0)