From af61fd186a876dd8c7d1a14b082e01d3018a34b5 Mon Sep 17 00:00:00 2001 From: tg Date: Wed, 11 Oct 2017 21:09:24 +0000 Subject: [PATCH] =?UTF-8?q?all=20uses=20of=20mksh=5Fvdirsep=20should=20exc?= =?UTF-8?q?lude=20=E2=80=9C\builtin=E2=80=9D=20from=20triggering=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- exec.c | 8 ++------ sh.h | 9 +++++---- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/exec.c b/exec.c index a206e2a..8330174 100644 --- a/exec.c +++ b/exec.c @@ -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; diff --git a/sh.h b/sh.h index 76febad..d645f8d 100644 --- a/sh.h +++ b/sh.h @@ -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('/'))