summaryrefslogtreecommitdiff
path: root/usr.bin/mg/search.c
diff options
context:
space:
mode:
authorChad Loder <cloder@cvs.openbsd.org>2005-05-27 05:55:13 +0000
committerChad Loder <cloder@cvs.openbsd.org>2005-05-27 05:55:13 +0000
commit9455d6f0117502b093c7e66fa7ea945aaff3eedd (patch)
tree6f2d856f5468da1349bf55c3f7a93ff6af3ac585 /usr.bin/mg/search.c
parent3c055c3dae52e819d4dba90a5afef73997aa6a97 (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/mg/search.c')
-rw-r--r--usr.bin/mg/search.c8
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;