summary refs log tree commit diff
diff options
context:
space:
mode:
authorBart Schaefer <barts@users.sourceforge.net>2001-08-25 16:44:15 +0000
committerBart Schaefer <barts@users.sourceforge.net>2001-08-25 16:44:15 +0000
commit135eebde601e57cd18b7e7815da9127533f09b0c (patch)
treea0ac7f4d10852e6552eafe50031a347b07f8a630
parentb70ec86efeef1c3e277f26922ceecfd678939c29 (diff)
downloadzsh-135eebde601e57cd18b7e7815da9127533f09b0c.tar.gz
zsh-135eebde601e57cd18b7e7815da9127533f09b0c.tar.xz
zsh-135eebde601e57cd18b7e7815da9127533f09b0c.zip
Fix crash on re-entry to loop() from preprompt().
-rw-r--r--ChangeLog5
-rw-r--r--Src/init.c7
2 files changed, 11 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 10962f9e2..064d2832a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2001-08-25  Bart Schaefer  <schaefer@zsh.org>
+
+	* 15707: Src/init.c: Fix history crash caused by re-entering
+	loop() when the `precmd' shell function uses `source' or `.'.
+
 2001-08-24  Sven Wischnowsky  <wischnow@zsh.org>
 
 	* 15705: Src/Zle/complete.c: test if hash table pointer is NULL
diff --git a/Src/init.c b/Src/init.c
index cbfaf5ad0..5a86800d1 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -107,6 +107,8 @@ loop(int toplevel, int justonce)
     pushheap();
     for (;;) {
 	freeheap();
+	if (stophist == 3)	/* re-entry via preprompt() */
+	    hend(NULL);
 	hbegin(1);		/* init history mech        */
 	if (isset(SHINSTDIN)) {
 	    setblock_stdin();
@@ -114,7 +116,10 @@ loop(int toplevel, int justonce)
 	        int hstop = stophist;
 		stophist = 3;
 		preprompt();
-		stophist = hstop;
+		if (stophist != 3)
+		    hbegin(1);
+		else
+		    stophist = hstop;
 		errflag = 0;
 	    }
 	}