all uses of mksh_vdirsep should exclude “\builtin” from triggering it

This commit is contained in:
tg 2017-10-11 21:09:24 +00:00
parent 5a89f6d959
commit af61fd186a
2 changed files with 7 additions and 10 deletions

8
exec.c
View File

@ -23,7 +23,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.200 2017/10/11 21:04:59 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.201 2017/10/11 21:09:24 tg Exp $");
#ifndef MKSH_DEFAULT_EXECSHELL
#define MKSH_DEFAULT_EXECSHELL MKSH_UNIXROOT "/bin/sh"
@ -1172,11 +1172,7 @@ findcom(const char *name, int flags)
char *fpath;
union mksh_cchack npath;
if (mksh_vdirsep(name)
#ifdef MKSH_DOSPATH
&& (strcmp(name, T_builtin) != 0)
#endif
) {
if (mksh_vdirsep(name)) {
insert = 0;
/* prevent FPATH search below */
flags &= ~FC_FUNC;

9
sh.h
View File

@ -182,7 +182,7 @@
#endif
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.844 2017/10/11 20:55:06 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.845 2017/10/11 21:09:24 tg Exp $");
#endif
#define MKSH_VERSION "R56 2017/08/29"
@ -2750,9 +2750,10 @@ extern int tty_init_fd(void); /* initialise tty_fd, tty_devtty */
#define mksh_sdirsep(s) strpbrk((s), "/\\")
#define mksh_vdirsep(s) __extension__({ \
const char *mksh_vdirsep_s = (s); \
((char *)((mksh_drvltr(mksh_vdirsep_s) && \
!mksh_cdirsep(mksh_vdirsep_s[2])) ? \
(mksh_vdirsep_s + 1) : strpbrk(mksh_vdirsep_s, "/\\"))); \
(((mksh_drvltr(mksh_vdirsep_s) && \
!mksh_cdirsep(mksh_vdirsep_s[2])) ? (!0) : \
(mksh_sdirsep(mksh_vdirsep_s) != NULL)) && \
(strcmp(mksh_vdirsep_s, T_builtin) != 0)); \
})
#else
#define mksh_abspath(s) (ord((s)[0]) == ord('/'))