From a0b1cbad83012b93f1e04f77cb3a067a9f37dd97 Mon Sep 17 00:00:00 2001 From: Binbin Date: Thu, 7 Nov 2024 12:13:00 +0800 Subject: [PATCH] Change errno from EEXIST to EALREADY in serverFork if child process exists (#1258) We set this to EEXIST in 568c2e039bac388003068cd8debb2f93619dd462, it prints "File exists" which is not quite accurate, change it to EALREADY, it will print "Operation already in progress". Signed-off-by: Binbin --- src/server.c | 2 +- tests/unit/moduleapi/fork.tcl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server.c b/src/server.c index 508edc711..5658b0511 100644 --- a/src/server.c +++ b/src/server.c @@ -6396,7 +6396,7 @@ void closeChildUnusedResourceAfterFork(void) { int serverFork(int purpose) { if (isMutuallyExclusiveChildType(purpose)) { if (hasActiveChildProcess()) { - errno = EEXIST; + errno = EALREADY; return -1; } diff --git a/tests/unit/moduleapi/fork.tcl b/tests/unit/moduleapi/fork.tcl index 9d1f9c184..bf53bd2db 100644 --- a/tests/unit/moduleapi/fork.tcl +++ b/tests/unit/moduleapi/fork.tcl @@ -26,7 +26,7 @@ start_server {tags {"modules"}} { # module fork twice assert_error {Fork failed} {r fork.create 0 1} - assert {[count_log_message 0 "Can't fork for module: File exists"] eq "1"} + assert {[count_log_message 0 "Can't fork for module: Operation already in progress"] eq "1"} r fork.kill