Subject: [PATCH] Extend file size support in paste.

From: Tobias Stoeckmann <[email-masked]>
Date: Sun, 23 Nov 2014 19:50:05 +0100

The function paste_parallel just has to remember if there was a character
in a line at all, not how many.  Changing size_t to a simple boolean
statement removes a possible overflow situation with 4 GB files on 32 bit
systems.
---
 src/paste.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/paste.c b/src/paste.c
index 2ca75d0..630a9a6 100644
--- a/src/paste.c
+++ b/src/paste.c
@@ -235,7 +235,7 @@ paste_parallel (size_t nfiles, char **fnamptr)
         {
           int chr IF_LINT ( = 0);	/* Input character. */
           int err IF_LINT ( = 0);	/* Input errno value.  */
-          size_t line_length = 0;	/* Number of chars in line. */
+          bool foundchar = false;	/* Found chars in a line. */
 
           if (fileptr[i])
             {
@@ -250,7 +250,7 @@ paste_parallel (size_t nfiles, char **fnamptr)
 
               while (chr != EOF)
                 {
-                  line_length++;
+                  foundchar = true;
                   if (chr == '\n')
                     break;
                   xputchar (chr);
@@ -259,7 +259,7 @@ paste_parallel (size_t nfiles, char **fnamptr)
                 }
             }
 
-          if (line_length == 0)
+          if (!foundchar)
             {
               /* EOF, read error, or closed file.
                  If an EOF or error, close the file.  */
-- 
2.1.1