Skip to contentSkip to conversation

ltp-pan: Use long long int to print time_t

PATCH New Khem Raj 2 participants 3 messages Dec 21, 2020 – Dec 22, 2020

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 ltp-pan: Use long long int to print time_t

Some newer 32bit architectures ( e.g. riscv32 ) uses 64bit time_t so using %ld is not sufficient to print time_t, this also fixes a crash in ltp-pan on riscv32

---
 pan/ltp-pan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
pan/ltp-pan.c +2 -2
index 8b9fbe5594..54b7cb8f26 100644
@@ -1389,8 +1389,8 @@ static void write_test_start(struct tag_pgrp *running, int no_kmsg)
 	if (!strcmp(reporttype, "rts")) {
 
 		printf
-		    ("%s\ntag=%s stime=%ld\ncmdline=\"%s\"\ncontacts=\"%s\"\nanalysis=%s\n%s\n",
-		     "<<<test_start>>>", running->cmd->name, running->mystime,
+		    ("%s\ntag=%s stime=%lld\ncmdline=\"%s\"\ncontacts=\"%s\"\nanalysis=%s\n%s\n",
+		     "<<<test_start>>>", running->cmd->name, (long long)running->mystime,
 		     running->cmd->cmdline, "", "exit", "<<<test_output>>>");
 	}
 	fflush(stdout);
Signature · 1 line
2.29.2
#1 lore raw

PATCH 1/1 ltp-pan: Use long long int to print time_t

Hi Khem,

Quoted 5 lines

Some newer 32bit architectures ( e.g. riscv32 ) uses 64bit time_t so using %ld is not sufficient to print time_t, this also fixes a crash in ltp-pan on riscv32

LGTM, thank you!

Kind regards,
Petr

Quoted 19 lines
---
 pan/ltp-pan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
pan/ltp-pan.c +2 -2
index 8b9fbe5594..54b7cb8f26 100644
@@ -1389,8 +1389,8 @@ static void write_test_start(struct tag_pgrp *running, int no_kmsg)
 	if (!strcmp(reporttype, "rts")) {
 
 		printf
-		    ("%s\ntag=%s stime=%ld\ncmdline=\"%s\"\ncontacts=\"%s\"\nanalysis=%s\n%s\n",
-		     "<<<test_start>>>", running->cmd->name, running->mystime,
+		    ("%s\ntag=%s stime=%lld\ncmdline=\"%s\"\ncontacts=\"%s\"\nanalysis=%s\n%s\n",
+		     "<<<test_start>>>", running->cmd->name, (long long)running->mystime,
 		     running->cmd->cmdline, "", "exit", "<<<test_output>>>");
 	}
 	fflush(stdout);
Applied
#2 lore raw

PATCH 1/1 ltp-pan: Use long long int to print time_t

Hi Khem,

Quoted 3 lines
Quoted 3 lines

Some newer 32bit architectures ( e.g. riscv32 ) uses 64bit time_t so using %ld is not sufficient to print time_t, this also fixes a crash in ltp-pan on riscv32

Merged, thanks!

Kind regards,
Petr