summaryrefslogtreecommitdiff
path: root/lib/report
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2017-02-15 11:01:49 -0500
committerZdenek Kabelac <zkabelac@redhat.com>2017-03-27 20:50:19 +0200
commit78d004efa8a1809cea68283e6204edfa9d7c1091 (patch)
tree42dce084f7ad65b21f54b2a0a3380f457de0fb29 /lib/report
parent36cac41115cca875f5d120631933b5dfb3c3c524 (diff)
downloadlvm2-78d004efa8a1809cea68283e6204edfa9d7c1091.tar.gz
build: fix x32 arch
This patch fixed lvm2 compilation running on x32 arch. (Using 64bit x86 cpu features but running on 32b address space, so consuming less mem in VM). On x32 arch 'time_t' is 64bit while 'long' is 32bit.
Diffstat (limited to 'lib/report')
-rw-r--r--lib/report/report.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/report/report.c b/lib/report/report.c
index 1421b31fa..d9880b206 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -1008,7 +1008,7 @@ static int _translate_time_items(struct dm_report *rh, struct time_info *info,
dm_pool_free(info->mem, info->ti_list);
info->ti_list = NULL;
- if (dm_snprintf(buf, sizeof(buf), "@%ld:@%ld", t1, t2) == -1) {
+ if (dm_snprintf(buf, sizeof(buf), "@" FMTd64 ":@" FMTd64, (int64_t)t1, (int64_t)t2) == -1) {
log_error("_translate_time_items: dm_snprintf failed");
return 0;
}
@@ -1063,10 +1063,10 @@ static void *_lv_time_handler_get_dynamic_value(struct dm_report *rh,
struct dm_pool *mem,
const char *data_in)
{
- time_t t1, t2;
+ int64_t t1, t2;
time_t *result;
- if (sscanf(data_in, "@%ld:@%ld", &t1, &t2) != 2) {
+ if (sscanf(data_in, "@" FMTd64 ":@" FMTd64, &t1, &t2) != 2) {
log_error("Failed to get value for parsed time specification.");
return NULL;
}
@@ -1076,8 +1076,8 @@ static void *_lv_time_handler_get_dynamic_value(struct dm_report *rh,
return NULL;
}
- result[0] = t1;
- result[1] = t2;
+ result[0] = (time_t) t1; /* Validate range for 32b arch ? */
+ result[1] = (time_t) t2;
return result;
}