Skip to content

Commit 4e67e7f

Browse files
committed
Fix test
1 parent ba35730 commit 4e67e7f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/library_fs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,10 +1066,10 @@ FS.staticInit();
10661066
FS.truncateCommon(node, undefined, len, false);
10671067
},
10681068
ftruncate(fd, len) {
1069-
if (len < 0) {
1069+
stream = FS.getStreamChecked(fd);
1070+
if (len < 0 || (stream.flags & {{{ cDefs.O_ACCMODE }}}) === {{{ cDefs.O_RDONLY}}}) {
10701071
throw new FS.ErrnoError({{{ cDefs.EINVAL }}});
10711072
}
1072-
stream = FS.getStreamChecked(fd);
10731073
FS.truncateCommon(stream.node, stream, len);
10741074
},
10751075
utime(path, atime, mtime) {

0 commit comments

Comments
 (0)