diff options
author | Chad Loder <cloder@cvs.openbsd.org> | 2005-05-27 05:55:13 +0000 |
---|---|---|
committer | Chad Loder <cloder@cvs.openbsd.org> | 2005-05-27 05:55:13 +0000 |
commit | 9455d6f0117502b093c7e66fa7ea945aaff3eedd (patch) | |
tree | 6f2d856f5468da1349bf55c3f7a93ff6af3ac585 /usr.bin | |
parent | 3c055c3dae52e819d4dba90a5afef73997aa6a97 (diff) |
Do not dump core if user hits ^g to exit minibuffer from search-forward.
Found by deraadt, ok kjell
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/mg/search.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/mg/search.c b/usr.bin/mg/search.c index 21e5cd21db8..af7fde28b4f 100644 --- a/usr.bin/mg/search.c +++ b/usr.bin/mg/search.c @@ -1,4 +1,4 @@ -/* $OpenBSD: search.c,v 1.14 2005/05/25 23:04:39 cloder Exp $ */ +/* $OpenBSD: search.c,v 1.15 2005/05/27 05:55:12 cloder Exp $ */ /* * Search commands. @@ -701,10 +701,12 @@ readpattern(char *prompt) rep = ereply("%s: (default %s) ", tpat, NPAT, prompt, pat); /* specified */ - if (rep != NULL && *rep != '\0') { + if (rep == NULL) { + retval = ABORT; + } else if (*rep != '\0') { (void) strlcpy(pat, tpat, sizeof(pat)); retval = TRUE; - } else if (*rep == '\0' && pat[0] != '\0') { + } else if (pat[0] != '\0') { retval = TRUE; } else retval = FALSE; |