aboutsummaryrefslogtreecommitdiff
path: root/modules/devices/devmemory.c
diff options
context:
space:
mode:
authorSimon Quigley <tsimonq2@ubuntu.com>2017-11-25 13:35:48 -0600
committerSimon Quigley <tsimonq2@ubuntu.com>2017-11-25 13:35:48 -0600
commit628a525ae2961f0461172613a0675dab6754c65e (patch)
tree9c16631a75cf703771196cabf274ee9eef9723d8 /modules/devices/devmemory.c
parentab16195359ad146263dbd7b5ea2d94316caee627 (diff)
parent11e616945340e87a1f567ab92e6dfac3068875b1 (diff)
Update upstream source from tag 'upstream/0.5.1+git20171103'
Update to upstream version '0.5.1+git20171103' with Debian dir 12de6f1245697675c1d76dc1085c08844d715cb0
Diffstat (limited to 'modules/devices/devmemory.c')
-rw-r--r--modules/devices/devmemory.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/modules/devices/devmemory.c b/modules/devices/devmemory.c
index 080e2bbe..29094dd8 100644
--- a/modules/devices/devmemory.c
+++ b/modules/devices/devmemory.c
@@ -23,7 +23,7 @@ GHashTable *memlabels = NULL;
void scan_memory_do(void)
{
- gchar **keys, *tmp, *tmp_label;
+ gchar **keys, *tmp, *tmp_label, *trans_val;
static gint offset = -1;
gint i;
@@ -68,12 +68,20 @@ void scan_memory_do(void)
tmp_label = ""; /* or newkeys[0] */
/* although it doesn't matter... */
- moreinfo_add_with_prefix("DEV", newkeys[0], g_strdup(newkeys[1]));
+ if (strstr(newkeys[1], "kB")) {
+ trans_val = g_strdup_printf("%d %s", atoi(newkeys[1]), _("KiB") );
+ } else {
+ trans_val = strdup(newkeys[1]);
+ }
- tmp = g_strconcat(meminfo, newkeys[0], "=", newkeys[1], "|", tmp_label, "\n", NULL);
+ moreinfo_add_with_prefix("DEV", newkeys[0], g_strdup(trans_val));
+
+ tmp = g_strconcat(meminfo, newkeys[0], "=", trans_val, "|", tmp_label, "\n", NULL);
g_free(meminfo);
meminfo = tmp;
+ g_free(trans_val);
+
tmp = g_strconcat(lginterval,
"UpdateInterval$", newkeys[0], "=1000\n", NULL);
g_free(lginterval);