Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[patch] Missing cast when printing time_t



When compiling on OpenBSD, clang points out that a time_t is printed as
a long while it's a long long. H/t jca for pointing out PRINTF_HAS_LLD.

- Matthew Martin


diff --git a/Src/Builtins/sched.c b/Src/Builtins/sched.c
index 70625ed..835e72c 100644
--- a/Src/Builtins/sched.c
+++ b/Src/Builtins/sched.c
@@ -353,7 +353,11 @@ schedgetfn(UNUSED(Param pm))
 	time_t t;
 
 	t = sch->time;
-	sprintf(tbuf, "%ld", t);
+#if defined(PRINTF_HAS_LLD)
+	sprintf(tbuf, "%lld", (long long)t);
+#else
+	sprintf(tbuf, "%ld", (long)t);
+#endif
 	if (sch->flags & SCHEDFLAG_TRASH_ZLE)
 	    flagstr = "-o";
 	else



Messages sorted by: Reverse Date, Date, Thread, Author