about summary refs log tree commit diff
path: root/Src/utils.c
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-09-21 01:37:26 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-09-21 01:37:26 +0000
commit1b60571be1ff3e455e23474809ed3d05ba1bff99 (patch)
tree9738407264a6ec24bf99ac04bf4e49d7f7be3595 /Src/utils.c
parentd18c1b3ac870ae682e5abf51b04e6ed8c9a4bd2d (diff)
downloadzsh-1b60571be1ff3e455e23474809ed3d05ba1bff99.tar.gz
zsh-1b60571be1ff3e455e23474809ed3d05ba1bff99.tar.xz
zsh-1b60571be1ff3e455e23474809ed3d05ba1bff99.zip
zsh-workers/7950
Diffstat (limited to 'Src/utils.c')
-rw-r--r--Src/utils.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/Src/utils.c b/Src/utils.c
index fcc8b72e3..38468969e 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -752,9 +752,14 @@ checkmailpath(char **s)
 		    fprintf(shout, "You have new mail.\n");
 		    fflush(shout);
 		} else {
-		    char *usav = underscore;
+		    VARARR(char, usav, underscorelen);
+		    int sl = strlen(*s);
 
-		    underscore = *s;
+		    if (sl >= underscorelen) {
+			zfree(underscore, underscorelen);
+			underscore = (char *) zalloc(underscorelen = sl + 32);
+		    }
+		    strcpy(underscore, *s);
 		    HEAPALLOC {
 			u = dupstring(u);
 			if (! parsestr(u)) {
@@ -763,8 +768,8 @@ checkmailpath(char **s)
 			    fputc('\n', shout);
 			    fflush(shout);
 			}
-			underscore = usav;
 		    } LASTALLOC;
+		    strcpy(underscore, usav);
 		}
 	    }
 	    if (isset(MAILWARNING) && st.st_atime > st.st_mtime &&