aboutsummaryrefslogtreecommitdiffhomepage
path: root/postfork.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-10-29 01:45:51 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-10-29 01:45:51 -0700
commit425afa63cec7015cbffb170c52ff32fc78a24ce7 (patch)
tree29dbf7ec3d2b79d997e91e9d668d365455e0b84f /postfork.cpp
parent7c09a767b6031720cb07505375cf8a6863fe1268 (diff)
Don't use posix_spawn when file redirections are involved (except /dev/null) because the error handling is too difficult
Fix exec to correctly handle the case where a pid could not be created due to posix_spawn failing Should fix https://github.com/fish-shell/fish-shell/issues/364
Diffstat (limited to 'postfork.cpp')
-rw-r--r--postfork.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/postfork.cpp b/postfork.cpp
index 9f94ae00..4379ca2d 100644
--- a/postfork.cpp
+++ b/postfork.cpp
@@ -566,6 +566,7 @@ void safe_report_exec_error(int err, const char *actual_cmd, char **argv, char *
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 address this by not using posix_spawn for file redirections, so all the ENOENTs we find must be errors from exec(). */
char interpreter_buff[128] = {}, *interpreter;
interpreter = get_interpreter(actual_cmd, interpreter_buff, sizeof interpreter_buff);
if( interpreter && 0 != access( interpreter, X_OK ) )
@@ -574,7 +575,7 @@ void safe_report_exec_error(int err, const char *actual_cmd, char **argv, char *
}
else
{
- debug_safe(0, "The file '%s' or a script or ELF interpreter does not exist, or a shared library needed for file or interpreter cannot be found.", actual_cmd);
+ debug_safe(0, "The file '%s' does not exist or could not be executed.", actual_cmd);
}
break;
}