diff --git a/src/postfork.cpp b/src/postfork.cpp index aeb6d223e..775b45a52 100644 --- a/src/postfork.cpp +++ b/src/postfork.cpp @@ -453,6 +453,7 @@ void safe_report_exec_error(int err, const char *actual_cmd, const char *const * break; } + case EACCES: case ENOENT: { // ENOENT is returned by exec() when the path fails, but also returned by posix_spawn if // an open file action fails. These cases appear to be impossible to distinguish. We @@ -481,24 +482,21 @@ void safe_report_exec_error(int err, const char *actual_cmd, const char *const * "Failed to execute process '%s': The file exists and is executable. " "Check the interpreter or linker?", actual_cmd); - } else { + } else if (err == ENOENT) { FLOGF_SAFE(exec, "Failed to execute process '%s': The file does not exist or could not " "be executed.", actual_cmd); + } else { + FLOGF_SAFE(exec, "Failed to execute process '%s': The file could not be accessed.", + actual_cmd); } break; } - case ENOMEM: { FLOGF_SAFE(exec, "Out of memory"); break; } - case EACCES: { - FLOGF_SAFE(exec, "Failed to execute process '%s': The file could not be accessed.", - actual_cmd); - break; - } case ETXTBSY: { FLOGF_SAFE(exec, "Failed to execute process '%s': File is currently open for writing.", actual_cmd);