summaryrefslogtreecommitdiffstats
path: root/text-utils/pg.c
diff options
context:
space:
mode:
authorRajeev V. Pillai2007-10-03 22:39:27 +0200
committerKarel Zak2007-10-03 22:39:27 +0200
commit2b00dd6d5491c31434e08434844d068e2aca5f0d (patch)
tree0c7d0d3a4db16bd8696e161ef647313e3c1027ea /text-utils/pg.c
parentsetarch: fix compiler warning (diff)
downloadkernel-qcow2-util-linux-2b00dd6d5491c31434e08434844d068e2aca5f0d.tar.gz
kernel-qcow2-util-linux-2b00dd6d5491c31434e08434844d068e2aca5f0d.tar.xz
kernel-qcow2-util-linux-2b00dd6d5491c31434e08434844d068e2aca5f0d.zip
pg: fix segfault on search
Run pg(1) and type '/<CR>' which is supposed to forward search for the previously remembered search string. pg(1) will segfault after printing "No remembered search string:". Signed-off-by: Rajeev V. Pillai <rajeevvp@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'text-utils/pg.c')
-rw-r--r--text-utils/pg.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/text-utils/pg.c b/text-utils/pg.c
index 3e1b25ea3..2defd9af8 100644
--- a/text-utils/pg.c
+++ b/text-utils/pg.c
@@ -1116,7 +1116,7 @@ pgfile(FILE *f, char *name)
*/
eof = 1;
}
- if (search == FORWARD) {
+ if (search == FORWARD && remembered == 1) {
if (eof) {
line = oldline;
search = searchcount = 0;