--- src/cmd/ksh93/sh/main.c +++ src/cmd/ksh93/sh/main.c 2006-05-09 12:26:48.000000000 +0200 @@ -210,37 +210,42 @@ } job_init(sh_isoption(SH_LOGIN_SHELL)); if(sh_isoption(SH_LOGIN_SHELL) && !sh_isoption(SH_NOPROFILE)) - { /* system profile */ sh_source(shp, iop, e_sysprofile); + /* make sure PWD is set up correctly */ + path_pwd(1); +#if SHOPT_SYSRC + if(!sh_isoption(SH_NOEXEC)) + { + if(!sh_isoption(SH_NOUSRPROFILE) && !sh_isoption(SH_PRIVILEGED) && sh_isoption(SH_RC)) + { +#if SHOPT_BASH + if(sh_isoption(SH_BASH) && !sh_isoption(SH_POSIX)) + sh_source(shp, iop, e_bash_sysrc); + else +#endif + sh_source(shp, iop, e_sysrc); + } + } +#endif + if(sh_isoption(SH_LOGIN_SHELL) && !sh_isoption(SH_NOPROFILE)) + { if(!sh_isoption(SH_NOUSRPROFILE) && !sh_isoption(SH_PRIVILEGED)) { char **files = shp->login_files; while ((name = *files++) && !sh_source(shp, iop, sh_mactry(name))); } } - /* make sure PWD is set up correctly */ - path_pwd(1); if(!sh_isoption(SH_NOEXEC)) { if(!sh_isoption(SH_NOUSRPROFILE) && !sh_isoption(SH_PRIVILEGED) && sh_isoption(SH_RC)) { #if SHOPT_BASH if(sh_isoption(SH_BASH) && !sh_isoption(SH_POSIX)) - { -#if SHOPT_SYSRC - sh_source(shp, iop, e_bash_sysrc); -#endif sh_source(shp, iop, shp->rcfile ? shp->rcfile : sh_mactry((char*)e_bash_rc)); - } else #endif - { -#if SHOPT_SYSRC - sh_source(shp, iop, e_sysrc); -#endif sh_source(shp, iop, sh_mactry(nv_getval(ENVNOD))); - } } else if(sh_isoption(SH_INTERACTIVE) && sh_isoption(SH_PRIVILEGED)) sh_source(shp, iop, e_suidprofile);