Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error being overridden incorrectly on FS.Rename #11812

Merged
merged 6 commits into from
Aug 19, 2020
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions src/library_fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -720,14 +720,13 @@ FS.staticInit();` +
var new_name = PATH.basename(new_path);
// parents must exist
var lookup, old_dir, new_dir;
try {
lookup = FS.lookupPath(old_path, { parent: true });
old_dir = lookup.node;
lookup = FS.lookupPath(new_path, { parent: true });
new_dir = lookup.node;
} catch (e) {
throw new FS.ErrnoError({{{ cDefine('EBUSY') }}});
}

// let the errors from non existant directories percolate up
lookup = FS.lookupPath(old_path, { parent: true });
old_dir = lookup.node;
lookup = FS.lookupPath(new_path, { parent: true });
new_dir = lookup.node;

if (!old_dir || !new_dir) throw new FS.ErrnoError({{{ cDefine('ENOENT') }}});
// need to be part of the same mount
if (old_dir.mount !== new_dir.mount) {
Expand Down