about summary refs log tree commit diff
path: root/Src/exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Src/exec.c b/Src/exec.c
index 8256910b3..ff34edb4b 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -3398,8 +3398,12 @@ loadautofn(Shfunc shf, int fksh, int autol)
     prog = getfpfunc(shf->nam, &ksh);
     noaliases = noalias;
 
-    if (ksh == 1)
+    if (ksh == 1) {
 	ksh = fksh;
+	if (ksh == 1)
+	    ksh = (shf->flags & PM_KSHSTORED) ? 2 :
+		  (shf->flags & PM_ZSHSTORED) ? 0 : 1;
+    }
 
     if (prog == &dummy_eprog) {
 	/* We're not actually in the function; decrement locallevel */