diff options
author | Dan McGee <dan@archlinux.org> | 2011-08-29 12:12:54 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-08-29 19:57:05 -0500 |
commit | 234b6ffc2c39268d1efdc414e02bc4b352e5d931 (patch) | |
tree | f01da20df830137e3954631e93a5ce698b310109 /lib/libalpm/util.h | |
parent | d74dad79b7770725090e1eb2a015cbd6f88aed66 (diff) | |
download | pacman-234b6ffc2c39268d1efdc414e02bc4b352e5d931.tar.xz |
Parse > 2GiB file sizes correctly
We were using atol(), which on 32 bit, cannot handle values greater than
2GiB, which is fail.
Switch to a strtoull() wrapper function tailored toward parsing off_t
values. This allows parsing of very large positive integer values. off_t
is a signed type, but in our usages, we never parse or have a need for
negative values, so the function will return -1 on error.
Before:
$ pacman -Si flightgear-data | grep Size
Download Size : 2097152.00 K
Installed Size : 2097152.00 K
After:
$ ./src/pacman/pacman -Si flightgear-data | grep Size
Download Size : 2312592.52 KiB
Installed Size : 5402896.00 KiB
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/util.h')
-rw-r--r-- | lib/libalpm/util.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h index 921ed459..c5544a04 100644 --- a/lib/libalpm/util.h +++ b/lib/libalpm/util.h @@ -119,6 +119,7 @@ int _alpm_archive_fgets(struct archive *a, struct archive_read_buffer *b); int _alpm_splitname(const char *target, char **name, char **version, unsigned long *name_hash); unsigned long _alpm_hash_sdbm(const char *str); +off_t _alpm_strtoofft(const char *line); long _alpm_parsedate(const char *line); int _alpm_raw_cmp(const char *first, const char *second); int _alpm_raw_ncmp(const char *first, const char *second, size_t max); |