mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-26 20:12:44 +00:00
fetch: MFC: make -S argument accept values > 2GB
Use strtoll() to parse the argument of the -S option.
FreeBSD has supported 64 bit file offsets for more than 25 years on
all architectures and off_t is a 64 bit integer type for that reason.
While strtol() returns a 64 bit value on 64 LP64 architectures, it
is limit to 32 bit on e.g. i386. The strtoll() function returns a 64
but result on all supported architectures and therefore supports the
possible file lengths and file offsets on 32 bit archtectures.
Reported by: antoine
(cherry picked from commit 32066c96fa
)
This commit is contained in:
parent
cacb5f3ea5
commit
9feba5ab90
@ -989,7 +989,7 @@ main(int argc, char *argv[])
|
||||
r_flag = 1;
|
||||
break;
|
||||
case 'S':
|
||||
S_size = (off_t)strtol(optarg, &end, 10);
|
||||
S_size = strtoll(optarg, &end, 10);
|
||||
if (*optarg == '\0' || *end != '\0')
|
||||
errx(1, "invalid size (%s)", optarg);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user