From 66a3320b78cb7155c95451292f73501fea739a18 Mon Sep 17 00:00:00 2001 From: "Rajeev V. Pillai" Date: Wed, 3 Oct 2007 22:39:27 +0200 Subject: [PATCH] pg: fix segfault on search Run pg(1) and type '/' 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 Signed-off-by: Karel Zak --- disk-utils/mkfs.cramfs.c | 2 +- text-utils/pg.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/disk-utils/mkfs.cramfs.c b/disk-utils/mkfs.cramfs.c index ca9335a3..b87097a8 100644 --- a/disk-utils/mkfs.cramfs.c +++ b/disk-utils/mkfs.cramfs.c @@ -895,7 +895,7 @@ int main(int argc, char **argv) if (fslen_ub < offset) { fprintf(stderr, _("not enough space allocated for ROM image " - "(%Ld allocated, %d used)\n"), + "(%lld allocated, %d used)\n"), fslen_ub, offset); exit(8); } diff --git a/text-utils/pg.c b/text-utils/pg.c index 3e1b25ea..2defd9af 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; -- 2.39.5