aboutsummaryrefslogtreecommitdiffstats
path: root/src/package.c
diff options
context:
space:
mode:
authorJason Woodward2011-06-26 22:56:02 +0000
committerJason Woodward2011-06-26 22:56:02 +0000
commit8425e6211f75f1bafdabb8cbdc52876b36724b76 (patch)
treea55e155e3060a1c63544024f9665ef9692debfcd /src/package.c
parent5bb022d221a53636548bf00b52d4ddcab4a33aa6 (diff)
downloadslapt-get-8425e6211f75f1bafdabb8cbdc52876b36724b76.tar.gz
Updated regex for reading /var/log/packages compressed and uncompressed sizes
Larger packages use 'M' instead of 'K' for size designation... account for this.
Diffstat (limited to 'src/package.c')
-rw-r--r--src/package.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/package.c b/src/package.c
index a94648b..04f307d 100644
--- a/src/package.c
+++ b/src/package.c
@@ -592,16 +592,24 @@ slapt_pkg_list_t *slapt_get_installed_pkgs(void)
slapt_execute_regex(compressed_size_reg,pkg_data);
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);
+ if ( strcmp(unit, "M") == 0 )
+ tmp_pkg->size_c *= 1024;
free(size_c);
+ free(unit);
}
/* pull out uncompressed size */
slapt_execute_regex(uncompressed_size_reg,pkg_data);
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);
+ if ( strcmp(unit, "M") == 0 )
+ tmp_pkg->size_u *= 1024;
free(size_u);
+ free(unit);
}
/* Ignore the location for installed packages */