main: find a script executed by extproc in current directory first

extproc does not pass a full path of a script. To find it, check
the existence of it manually in the current directory before in $PATH.

This is the fix of regression of commit
1b4d572b77.

    modified:   main.c
This commit is contained in:
KO Myung-Hun 2017-01-11 12:46:36 +09:00
parent e0355b78a9
commit a5da1fa0b6
1 changed files with 3 additions and 1 deletions

4
main.c
View File

@ -470,7 +470,9 @@ main_init(int argc, const char *argv[], Source **sp, struct block **lp)
* to search for it. This changes the behaviour of a
* simple "mksh foo", but can't be helped.
*/
s->file = search_path(argv[argi++], path, X_OK, NULL);
s->file = argv[argi++];
if (search_access(s->file, X_OK) != 0)
s->file = search_path(s->file, path, X_OK, NULL);
if (!s->file || !*s->file)
s->file = argv[argi - 1];
#else