From: Rajeev V. Pillai Date: Wed, 3 Oct 2007 20:39:27 +0000 (+0200) Subject: pg: fix segfault on search X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2b00dd6d5491c31434e08434844d068e2aca5f0d;p=util-linux 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 --- 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;