From: Jim Meyering Date: Tue, 13 Nov 2001 10:23:44 +0000 (+0000) Subject: (tail_lines): Move declaration of local `length' into scope where it's used. X-Git-Tag: TEXTUTILS-2_0_17~84 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9a628d390809bdcfbe777f751b1019182fefb951;p=thirdparty%2Fcoreutils.git (tail_lines): Move declaration of local `length' into scope where it's used. (tail_file): Likewise for local `stats'. --- diff --git a/src/tail.c b/src/tail.c index 375e6316bd..c6d4225727 100644 --- a/src/tail.c +++ b/src/tail.c @@ -1073,7 +1073,6 @@ static int tail_lines (const char *pretty_filename, int fd, long int n_lines) { struct stat stats; - off_t length; /* We need binary input, since `tail' relies on `lseek' and byte counts, while binary output will preserve the style (Unix/DOS) of text file. */ @@ -1093,6 +1092,8 @@ tail_lines (const char *pretty_filename, int fd, long int n_lines) } else { + off_t length; + /* Use file_lines only if FD refers to a regular file with its file pointer positioned at beginning of file. */ /* FIXME: this first lseek conjunct is a kludge. @@ -1132,7 +1133,6 @@ static int tail_file (struct File_spec *f, off_t n_units) { int fd, errors; - struct stat stats; int is_stdin = (STREQ (f->name, "-")); @@ -1168,6 +1168,8 @@ tail_file (struct File_spec *f, off_t n_units) errors = tail (pretty_name (f), fd, n_units); if (forever) { + struct stat stats; + f->errnum = 0; /* FIXME: duplicate code */ if (fstat (fd, &stats) < 0)