zsh-workers
 help / color / mirror / code / Atom feed
* [patch] Missing cast when printing time_t
@ 2016-05-19  2:51 Matthew Martin
  0 siblings, 0 replies; only message in thread
From: Matthew Martin @ 2016-05-19  2:51 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-05-19  2:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-19  2:51 [patch] Missing cast when printing time_t Matthew Martin

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).