bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LFS bug in tail


From: Andreas Schwab
Subject: LFS bug in tail
Date: Fri Sep 27 12:28:02 2002
User-agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.3.50 (ia64-suse-linux)

This fixes an LFS bug in tail.  On systems where sizeof (size_t) < sizeof
(off_t) an overflow can occur when bytes_remaining is assigned, so that
tail on a big file > 4G does not work correctly.

Andreas.

2002-09-27  Andreas Schwab  <address@hidden>

        * src/tail.c (tail_bytes): Change type of bytes_remaining to off_t
        to avoid overflow.  Reported by Hans Lermen.

--- src/tail.c  2002/09/27 12:01:49     1.1
+++ src/tail.c  2002/09/27 12:02:18
@@ -1072,7 +1072,7 @@ tail_bytes (const char *pretty_filename,
       if (S_ISREG (stats.st_mode))
        {
          off_t current_pos, end_pos;
-         size_t bytes_remaining;
+         off_t bytes_remaining;
 
          if ((current_pos = lseek (fd, (off_t) 0, SEEK_CUR)) != -1
              && (end_pos = lseek (fd, (off_t) 0, SEEK_END)) != -1)

-- 
Andreas Schwab, SuSE Labs, address@hidden
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]