From 78d004efa8a1809cea68283e6204edfa9d7c1091 Mon Sep 17 00:00:00 2001 From: Mikulas Patocka Date: Wed, 15 Feb 2017 11:01:49 -0500 Subject: 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. --- lib/report/report.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/report') 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; } -- cgit v1.2.1