From aacf801b253e1e608ab46a4ccee87e943734742e Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Tue, 4 Dec 2018 15:34:33 +0000 Subject: ash: fix a couple of test cases The ash tests exitcode_EACCES and exitcode_ENOENT both failed. In commit 92dbd3c09 a test was added to tryexec to check that the file being run existed and was executable. The error codes returned by this test were incorrect. The slightly later commit f5783ef14 added a similar test in spawnveq which got the error codes right. Remove the test from tryexec and some superfluous error messages from spawnveq. --- shell/ash.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'shell') diff --git a/shell/ash.c b/shell/ash.c index 4c23286c1..510a86cab 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -8387,10 +8387,6 @@ static int builtinloc = -1; /* index in path of %builtin, or -1 */ static void tryexec(IF_FEATURE_SH_STANDALONE(int applet_no,) const char *cmd, char **argv, char **envp) { -#if ENABLE_PLATFORM_MINGW32 - char *new_cmd; -#endif - #if ENABLE_FEATURE_SH_STANDALONE if (applet_no >= 0) { if (APPLET_IS_NOEXEC(applet_no)) { @@ -8408,13 +8404,11 @@ tryexec(IF_FEATURE_SH_STANDALONE(int applet_no,) const char *cmd, char **argv, c #endif #if ENABLE_PLATFORM_MINGW32 - /* ensure we have a path to a real, executable file */ - if (!(new_cmd=add_win32_extension(cmd)) && !file_is_executable(cmd)) { - errno = EACCES; - return; + { + char *new_cmd = add_win32_extension(cmd); + execve(new_cmd ? new_cmd : cmd, argv, envp); + free(new_cmd); } - execve(new_cmd ? new_cmd : cmd, argv, envp); - free(new_cmd); /* skip POSIX-mandated retry on ENOEXEC */ #else repeat: -- cgit v1.2.3-55-g6feb