Skip to content

Commit 9f1dfb6

Browse files
authored
[WasmFS] Simplify wasmfs_unmount. NFC (#23821)
1 parent d6a1e01 commit 9f1dfb6

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

system/lib/wasmfs/syscalls.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -884,16 +884,16 @@ int wasmfs_unmount(const char* path) {
884884
return -EBUSY;
885885
}
886886

887-
if (auto dir = file->dynCast<Directory>()) {
888-
if (parent->getBackend() == dir->getBackend()) {
889-
// The child is not a valid mountpoint.
890-
return -EINVAL;
891-
}
892-
} else {
887+
if (!file->dynCast<Directory>()) {
893888
// A normal file or symlink.
894889
return -ENOTDIR;
895890
}
896891

892+
if (parent->getBackend() == file->getBackend()) {
893+
// The child is not a valid mountpoint.
894+
return -EINVAL;
895+
}
896+
897897
// Input is valid, perform the unlink.
898898
return lockedParent.removeChild(childName);
899899
}

0 commit comments

Comments
 (0)