From 99fb293138b72521a982c84ff789d43637ad5e51 Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Mon, 16 Dec 2024 17:48:16 +0100 Subject: [PATCH] Fix test_unlink --- src/library_fs.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/library_fs.js b/src/library_fs.js index 38c31f0029be6..33e0ecef7b644 100644 --- a/src/library_fs.js +++ b/src/library_fs.js @@ -885,6 +885,7 @@ FS.staticInit(); #endif parent.node_ops.rmdir(parent, name); FS.destroyNode(node); + node.parent = null; #if FS_DEBUG if (FS.trackingDelegate['onDeletePath']) { FS.trackingDelegate['onDeletePath'](path); @@ -895,6 +896,9 @@ FS.staticInit(); FS.readdirNode(FS.lookupPath(path, { follow: true }).node); }, readdirNode(node) { + if (!node.parent) { + return []; + } if (!node.node_ops.readdir) { throw new FS.ErrnoError({{{ cDefs.ENOTDIR }}}); }