mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH] strftime: fix underlying format string in %z format
@ 2018-06-11 17:15 Daniel Sabogal
  2018-06-26 20:45 ` Rich Felker
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Sabogal @ 2018-06-11 17:15 UTC (permalink / raw)
  To: musl

the expression (tm->__tm_gmtoff)/3600 has type long. use %+.2ld instead.
---
 src/time/strftime.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/time/strftime.c b/src/time/strftime.c
index 708875ee..0a256970 100644
--- a/src/time/strftime.c
+++ b/src/time/strftime.c
@@ -181,7 +181,7 @@ const char *__strftime_fmt_1(char (*s)[100], size_t *l, int f, const struct tm *
 			*l = 0;
 			return "";
 		}
-		*l = snprintf(*s, sizeof *s, "%+.2d%.2d",
+		*l = snprintf(*s, sizeof *s, "%+.2ld%.2d",
 			(tm->__tm_gmtoff)/3600,
 			abs(tm->__tm_gmtoff%3600)/60);
 		return *s;
-- 
2.17.1



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] strftime: fix underlying format string in %z format
  2018-06-11 17:15 [PATCH] strftime: fix underlying format string in %z format Daniel Sabogal
@ 2018-06-26 20:45 ` Rich Felker
  0 siblings, 0 replies; 2+ messages in thread
From: Rich Felker @ 2018-06-26 20:45 UTC (permalink / raw)
  To: musl

On Mon, Jun 11, 2018 at 01:15:15PM -0400, Daniel Sabogal wrote:
> the expression (tm->__tm_gmtoff)/3600 has type long. use %+.2ld instead.
> ---
>  src/time/strftime.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/time/strftime.c b/src/time/strftime.c
> index 708875ee..0a256970 100644
> --- a/src/time/strftime.c
> +++ b/src/time/strftime.c
> @@ -181,7 +181,7 @@ const char *__strftime_fmt_1(char (*s)[100], size_t *l, int f, const struct tm *
>  			*l = 0;
>  			return "";
>  		}
> -		*l = snprintf(*s, sizeof *s, "%+.2d%.2d",
> +		*l = snprintf(*s, sizeof *s, "%+.2ld%.2d",
>  			(tm->__tm_gmtoff)/3600,
>  			abs(tm->__tm_gmtoff%3600)/60);
>  		return *s;
> -- 
> 2.17.1

Thanks. Applied.

Rich


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-26 20:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-11 17:15 [PATCH] strftime: fix underlying format string in %z format Daniel Sabogal
2018-06-26 20:45 ` Rich Felker

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

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

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).