Subject: bin/36955: script(1) may not work on files larger than LONG_MAX
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <ighighi@gmail.com>
List: netbsd-bugs
Date: 09/09/2007 09:15:04
>Number:         36955
>Category:       bin
>Synopsis:       script(1) may not work on files larger than LONG_MAX
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Sep 09 09:15:04 +0000 2007
>Originator:     Ighighi
>Release:        none
>Organization:
>Environment:
>Description:
When porting the record/playback options to FreeBSD I noticed that it uses
fseek() instead of fseeko().  Since fseek() uses a "long", we cannot pass
values larger than LONG_MAX.  It must use fseeko() instead to pass an off_t.

Note: I haven't tested the bug since I'm running FreeBSD right now and I'm
too lazy to create a large file when the fix is trivial.
>How-To-Repeat:

>Fix:
--- script.c.orig       2007-08-19 23:44:17.000000000 -0400
+++ script.c    2007-09-09 04:55:11.582595978 -0400
@@ -310,7 +310,7 @@ consume(FILE *fscript, off_t len, char *
        size_t l;

        if (reg) {
-               if (fseek(fscript, len, SEEK_CUR) == -1)
+               if (fseeko(fscript, len, SEEK_CUR) == -1)
                        err(1, NULL);
        }
        else {