From: Daniel Wagner Date: Mon, 17 Feb 2025 13:57:49 +0000 (+0100) Subject: plugins/virtium: fix print format string X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=e2a901dca5803e961352e1d8b3a6eb9b30bc944c;p=users%2Fsagi%2Fnvme-cli.git 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 --- 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);