X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/blobdiff_plain/57e3f2b5b2cb3c0730e81d42b5f741a05aedd667..45c6d8c4132b612b445b858c6ed1d930140bc840:/contrib/tcsh-6/sh.c diff --git a/contrib/tcsh-6/sh.c b/contrib/tcsh-6/sh.c index 73b6d7f548..7d70183230 100644 --- a/contrib/tcsh-6/sh.c +++ b/contrib/tcsh-6/sh.c @@ -649,13 +649,17 @@ main(int argc, char **argv) /* * Re-initialize path if set in environment */ - if ((tcp = getenv("PATH")) == NULL) + if ((tcp = getenv("PATH")) == NULL) { #ifdef _PATH_DEFPATH importpath(str2short(_PATH_DEFPATH)); #else /* !_PATH_DEFPATH */ setq(STRpath, defaultpath(), &shvhed, VAR_READWRITE); #endif /* _PATH_DEFPATH */ - else + /* + * Export the path setting so that subsequent processes use the same path as we do. + */ + exportpath(adrof(STRpath)->vec); + } else /* Importpath() allocates memory for the path, and the * returned pointer from SAVE() was discarded, so * this was a memory leak.. (sg)