]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
plugins/virtium: fix print format string
authorDaniel Wagner <wagi@kernel.org>
Mon, 17 Feb 2025 13:57:49 +0000 (14:57 +0100)
committerDaniel Wagner <wagi@monom.org>
Mon, 17 Feb 2025 14:25:00 +0000 (15:25 +0100)
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 <wagi@kernel.org>
plugins/virtium/virtium-nvme.c

index ad9938d45db9c67085215825489448b461a0b6cc..50b2a5433b96fc9d3647e98ab8fb4708a922b627 100644 (file)
@@ -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);