aboutsummaryrefslogtreecommitdiffstats
path: root/src/package.c
diff options
context:
space:
mode:
authorJason Woodward2014-04-03 22:54:32 -0400
committerJason Woodward2014-04-03 22:57:08 -0400
commit0f36e5bd3564ff36f5deb829106ee935b3b18c85 (patch)
tree155a4b8875de12ce77851a2eb6225a8ad392fe09 /src/package.c
parent56c8f3efb94a1ed65edb6ed7e67eb2882842bd2a (diff)
downloadslapt-get-0f36e5bd3564ff36f5deb829106ee935b3b18c85.tar.gz
support fractional installed size from /var/log/packages files
Diffstat (limited to 'src/package.c')
-rw-r--r--src/package.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/package.c b/src/package.c
index 9524cb0..1f055ad 100644
--- a/src/package.c
+++ b/src/package.c
@@ -598,7 +598,8 @@ slapt_pkg_list_t *slapt_get_installed_pkgs(void)
if (compressed_size_reg->reg_return == 0) {
char *size_c = slapt_regex_extract_match(compressed_size_reg, pkg_data, 1);
char *unit = slapt_regex_extract_match(compressed_size_reg, pkg_data, 2);
- tmp_pkg->size_c = strtol(size_c,(char **)NULL,10);
+ double c = strtof(size_c, (char **)NULL);
+ tmp_pkg->size_c = round(c);
if ( strcmp(unit, "M") == 0 )
tmp_pkg->size_c *= 1024;
free(size_c);
@@ -610,7 +611,8 @@ slapt_pkg_list_t *slapt_get_installed_pkgs(void)
if (uncompressed_size_reg->reg_return == 0 ) {
char *size_u = slapt_regex_extract_match(uncompressed_size_reg, pkg_data, 1);
char *unit = slapt_regex_extract_match(uncompressed_size_reg, pkg_data, 2);
- tmp_pkg->size_u = strtol(size_u,(char **)NULL,10);
+ double u = strtof(size_u, (char **)NULL);
+ tmp_pkg->size_u = round(u);
if ( strcmp(unit, "M") == 0 )
tmp_pkg->size_u *= 1024;
free(size_u);