diff options
author | Karel Zak | 2006-12-07 00:25:48 +0100 |
---|---|---|
committer | Karel Zak | 2006-12-07 00:25:48 +0100 |
commit | 364cda4857f7dd5e2b4e2eb7583a2eaa279ef4ed (patch) | |
tree | c60dfad813ca42bf619fe2ac8ce893d2331e508f /text-utils/more.c | |
parent | Imported from util-linux-2.11b tarball. (diff) | |
download | kernel-qcow2-util-linux-364cda4857f7dd5e2b4e2eb7583a2eaa279ef4ed.tar.gz kernel-qcow2-util-linux-364cda4857f7dd5e2b4e2eb7583a2eaa279ef4ed.tar.xz kernel-qcow2-util-linux-364cda4857f7dd5e2b4e2eb7583a2eaa279ef4ed.zip |
Imported from util-linux-2.11f tarball.
Diffstat (limited to 'text-utils/more.c')
-rw-r--r-- | text-utils/more.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/text-utils/more.c b/text-utils/more.c index ac62d070c..0411b17fe 100644 --- a/text-utils/more.c +++ b/text-utils/more.c @@ -529,7 +529,7 @@ checkf (fs, clearfirst) if (magic(f, fs)) return((FILE *)NULL); c = Getc(f); - *clearfirst = c == '\f'; + *clearfirst = (c == '\f'); Ungetc (c, f); if ((file_size = stbuf.st_size) == 0) file_size = LONG_MAX; @@ -548,6 +548,10 @@ magic(f, fs) { char twobytes[2]; + /* don't try to look ahead if the input is unseekable */ + if (fseek(f, 0L, SEEK_SET)) + return(0); + if (fread(twobytes, 2, 1, f) == 1) { switch(twobytes[0] + (twobytes[1]<<8)) { case OMAGIC: /* 0407 */ |