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

Re: [PATCH] ztrftime(): Fix truncation for %.



dana wrote on Sat, 29 Dec 2018 05:02 -0600:
> +++ b/Src/utils.c
> @@ -3334,19 +3334,28 @@ morefmt:
>  #endif
>  	    switch (*fmt++) {
>  	    case '.':
> -		if (ztrftimebuf(&bufsize, digs))
> -		    return -1;
> +	    {
>  		if (digs > 9)
>  		    digs = 9;
> +		if (ztrftimebuf(&bufsize, digs))
> +		    return -1;
> +		long fnsec = nsec;

C89 does not allow defining variables in the middle of a block, so
you'll need to move the definition of 'fnsec' to immediately after the
opening braces.

With that changed, +1.

Cheers,

Daniel



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