summaryrefslogtreecommitdiffstats
path: root/text-utils/more.c
diff options
context:
space:
mode:
authorKarel Zak2006-12-07 00:25:48 +0100
committerKarel Zak2006-12-07 00:25:48 +0100
commit364cda4857f7dd5e2b4e2eb7583a2eaa279ef4ed (patch)
treec60dfad813ca42bf619fe2ac8ce893d2331e508f /text-utils/more.c
parentImported from util-linux-2.11b tarball. (diff)
downloadkernel-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.c6
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 */