about summary refs log tree commit diff
path: root/Src/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/init.c')
-rw-r--r--Src/init.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Src/init.c b/Src/init.c
index decc7617e..0c874eead 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -111,13 +111,17 @@ loop(int toplevel, int justonce)
 	    if (toplevel && (prelist = getshfunc("preexec")) != &dummy_list) {
 		Histent he = gethistent(curhist);
 		LinkList args;
+		int osc = sfcontext;
+
 		PERMALLOC {
 		    args = newlinklist();
 		    addlinknode(args, "preexec");
 		    if (he && he->text)
 			addlinknode(args, he->text);
 		} LASTALLOC;
+		sfcontext = SFC_HOOK;
 		doshfunc("preexec", prelist, args, 0, 1);
+		sfcontext = osc;
 		freelinklist(args, (FreeFunc) NULL);
 		errflag = 0;
 	    }
@@ -613,6 +617,7 @@ setupvals(void)
     breaks = loops = 0;
     lastmailcheck = time(NULL);
     locallevel = sourcelevel = 0;
+    sfcontext = SFC_DIRECT;
     trapreturn = 0;
     noerrexit = -1;
     nohistsave = 1;