summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--src/parser.c11
2 files changed, 7 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index a821c32..d50d36c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2007-10-20  Herbert Xu <herbert@gondor.apana.org.au>
 
 	* Added configure --enable-glob and --enable-fnmatch options.
+	* Fix here-doc corruption.
 
 2007-10-17  Herbert Xu <herbert@gondor.apana.org.au>
 
diff --git a/src/parser.c b/src/parser.c
index 4b8a5fe..3832f0b 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -1047,16 +1047,17 @@ checkend: {
 		if (c == *eofmark) {
 			if (pfgets(line, sizeof line) != NULL) {
 				char *p, *q;
+				int cc;
 
 				p = line;
 				for (q = eofmark + 1;; p++, q++) {
-					c = *p;
-					if (c == '\n')
-						c = 0;
-					if (!*q || c != *q)
+					cc = *p;
+					if (cc == '\n')
+						cc = 0;
+					if (!*q || cc != *q)
 						break;
 				}
-				if (c == *q) {
+				if (cc == *q) {
 					c = PEOF;
 					plinno++;
 					needprompt = doprompt;