Skip to content

Commit 1b4a151

Browse files
committed
fs: fix rmSync error code
Return the correct error code, when a directory_not_empty error occurred. Fixes: #57095
1 parent f1b951f commit 1b4a151

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/node_file.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1705,7 +1705,7 @@ static void RmSync(const FunctionCallbackInfo<Value>& args) {
17051705
return env->ThrowErrnoException(EPERM, "rm", message.c_str(), path_c_str);
17061706
} else if (error == std::errc::directory_not_empty) {
17071707
std::string message = "Directory not empty: " + file_path_str;
1708-
return env->ThrowErrnoException(EACCES, "rm", message.c_str(), path_c_str);
1708+
return env->ThrowErrnoException(ENOTEMPTY, "rm", message.c_str(), path_c_str);
17091709
} else if (error == std::errc::not_a_directory) {
17101710
std::string message = "Not a directory: " + file_path_str;
17111711
return env->ThrowErrnoException(ENOTDIR, "rm", message.c_str(), path_c_str);

0 commit comments

Comments
 (0)