]> err.no Git - util-linux/commitdiff
pg: fix segfault on search
authorRajeev V. Pillai <rajeevvp@gmail.com>
Wed, 3 Oct 2007 20:39:27 +0000 (22:39 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 3 Oct 2007 20:39:27 +0000 (22:39 +0200)
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>
disk-utils/mkfs.cramfs.c
text-utils/pg.c

index ca9335a37f67f7db68cf25d8fc9ffa1bf83526cc..b87097a8a3ca8900ebbf55a5628c8c3529e56900 100644 (file)
@@ -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);
        }
index 3e1b25ea345b0189490bb2e85969cd28eb562311..2defd9af864b439d1f89934d10e9209da18780d9 100644 (file)
@@ -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;