From 2b9e17a6806bb1480ebc946945b44805dcaa8de9 Mon Sep 17 00:00:00 2001 From: Bart Oldeman Date: Sat, 31 Jan 2004 11:39:50 +0000 Subject: [PATCH] Only put PATH= in the environment if it's still empty just before executing the shell. This repairs SET PATH=.... in config.sys without confusing anyone. git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@762 6ac86273-5f31-0410-b378-82cca8765d1b --- kernel/config.c | 4 ++-- kernel/main.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/config.c b/kernel/config.c index 001705f..d46ca41 100644 --- a/kernel/config.c +++ b/kernel/config.c @@ -137,8 +137,8 @@ UWORD ram_top = 0; /* How much ram in Kbytes */ static UBYTE ErrorAlreadyPrinted[128]; -char master_env[128] = {"PATH="}; /* some shells panic on empty master env. */ -static char *envp = master_env + 6; /* point to the second zero */ +char master_env[128] = {0}; +static char *envp = master_env; struct config Config = { 0, diff --git a/kernel/main.c b/kernel/main.c index 05d6fd8..079eca5 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -364,6 +364,8 @@ STATIC void kernel() int rc; exb.exec.env_seg = DOS_PSP + 8; + if (master_env[0] == '\0') /* some shells panic on empty master env. */ + strcpy(master_env, "PATH=."); fmemcpy(MK_FP(exb.exec.env_seg, 0), master_env, sizeof(master_env)); /* process 0 */