diff options
author | hoek <hoek@FreeBSD.org> | 2000-05-09 03:53:13 +0000 |
---|---|---|
committer | hoek <hoek@FreeBSD.org> | 2000-05-09 03:53:13 +0000 |
commit | 248fe6ed253c6e46718d78fafcb73869e775c2b5 (patch) | |
tree | 77fd157f1fd2ffc283434fc854c7d8fc87d3b1bf /usr.bin | |
parent | f4fed92e9a17e629b63e6e3c8e4c119e0d58a94e (diff) | |
download | FreeBSD-src-248fe6ed253c6e46718d78fafcb73869e775c2b5.zip FreeBSD-src-248fe6ed253c6e46718d78fafcb73869e775c2b5.tar.gz |
Don't segv if viewing "#" and there is no prev-file (long-standing).
Staticize a variable that was meant to be static (broken in r.1.11).
PR: bin/11370 Henry Whincup <henry@techiebod.com> (for the segv)
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/more/main.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/more/main.c b/usr.bin/more/main.c index cbe853c..a41f8e9 100644 --- a/usr.bin/more/main.c +++ b/usr.bin/more/main.c @@ -93,7 +93,8 @@ edit(filename) { register int f; register char *m; - off_t initial_pos, prev_pos, position(); + off_t initial_pos, position(); + static off_t prev_pos; static int didpipe; char message[MAXPATHLEN + 50], *p; char *rindex(), *strerror(), *save(), *bad_file(); @@ -107,7 +108,7 @@ edit(filename) filename = save(av[curr_ac]); } else if (strcmp(filename, "#") == 0) { - if (*previous_file == '\0') { + if (!previous_file || *previous_file == '\0') { error("no previous file"); return(0); } |