Skip to content
Merged
Changes from all 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
2 changes: 1 addition & 1 deletion system/lib/wasmfs/backends/node_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ class NodeDirectory : public Directory {
}

auto childPath = getChildPath(name);
return _wasmfs_node_rename(fromPath.c_str(), childPath.c_str());
return -_wasmfs_node_rename(fromPath.c_str(), childPath.c_str());
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I think this is wrong. IIUC, there are 3 classes of functions at play:

  1. The _wasmfs_node_xxx API. These return positive error codes.
  2. The internal C++ API for wasm (e.g. insertMove). These also return positive error codes.
  3. The __syscall_xxx API: These return negative error codes.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure about point (2)? See for example:

// Move the file represented by `file` from its current directory to this
// directory with the new `name`, possibly overwriting another file that
// already exists with that name. The old directory may be the same as this
// directory. On success return 0 and otherwise return a negative error code
// without changing any underlying state. This should only be called from
// renameat with the locks on the old and new parents already held.
[[nodiscard]] int insertMove(const std::string& name,
std::shared_ptr<File> file);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh.. I stand corrected. Sorry about that.

}

ssize_t getNumEntries() override {
Expand Down
Loading