From e2a901dca5803e961352e1d8b3a6eb9b30bc944c Mon Sep 17 00:00:00 2001 From: Daniel Wagner Date: Mon, 17 Feb 2025 14:57:49 +0100 Subject: [PATCH] plugins/virtium: fix print format string time_ms is of type time_t which is not really portable to use. Let's cast it to the longest type which works on 32bit and 64bit. Signed-off-by: Daniel Wagner --- plugins/virtium/virtium-nvme.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/virtium/virtium-nvme.c b/plugins/virtium/virtium-nvme.c index ad9938d4..50b2a543 100644 --- a/plugins/virtium/virtium-nvme.c +++ b/plugins/virtium/virtium-nvme.c @@ -127,8 +127,10 @@ static void vt_convert_smart_data_to_human_readable_format(struct vtview_smart_l capacity = le64_to_cpu(smart->raw_ns.nsze) * lba; - snprintf(tempbuff, sizeof(tempbuff), "log;%s;%lu;%s;%s;%-.*s;", smart->raw_ctrl.sn, smart->time_stamp, smart->path, - smart->raw_ctrl.mn, (int)sizeof(smart->raw_ctrl.fr), smart->raw_ctrl.fr); + snprintf(tempbuff, sizeof(tempbuff), "log;%s;%llu;%s;%s;%-.*s;", smart->raw_ctrl.sn, + (unsigned long long)smart->time_stamp, smart->path, + smart->raw_ctrl.mn, (int)sizeof(smart->raw_ctrl.fr), + smart->raw_ctrl.fr); strcpy(text, tempbuff); snprintf(tempbuff, sizeof(tempbuff), "Capacity;%lf;", capacity / 1000000000); strcat(text, tempbuff); -- 2.50.1