Skip to content

Commit

Permalink
all uses of mksh_vdirsep should exclude “\builtin” from triggering it
Browse files Browse the repository at this point in the history
  • Loading branch information
mirabilos committed Oct 11, 2017
1 parent 5a89f6d commit af61fd1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
8 changes: 2 additions & 6 deletions exec.c
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand Down
9 changes: 5 additions & 4 deletions sh.h
Expand Up @@ -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"

Expand Down Expand Up @@ -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('/'))
Expand Down

0 comments on commit af61fd1

Please sign in to comment.