do not use getenv() to allow users to change OS2_SHELL during the session

This commit is contained in:
tg 2017-04-02 15:02:40 +00:00
parent 718d397fff
commit b446727285
1 changed files with 2 additions and 2 deletions

4
exec.c
View File

@ -23,7 +23,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.193 2017/04/02 15:00:42 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.194 2017/04/02 15:02:40 tg Exp $");
#ifndef MKSH_DEFAULT_EXECSHELL
#define MKSH_DEFAULT_EXECSHELL MKSH_UNIXROOT "/bin/sh"
@ -982,7 +982,7 @@ scriptexec(struct op *tp, const char **ap)
cp = _getext(tp->str);
if (cp && (!stricmp(cp, ".cmd") || !stricmp(cp, ".bat"))) {
/* execute .cmd and .bat with OS2_SHELL, usually CMD.EXE */
sh = getenv("OS2_SHELL");
sh = str_val(global("OS2_SHELL"));
*tp->args-- = "/c";
/* convert slahes to backslashes */
for (cp = tp->str; *cp; cp++) {