summary refs log tree commit diff
path: root/Src/Modules/zftp.c
diff options
context:
space:
mode:
authorWesley Schwengle <wesley@schwengle.net>2019-03-25 23:01:43 +0900
committerJun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>2019-03-25 23:01:43 +0900
commit5ca680c93cb28c6616cc8f82db80a2425685dc38 (patch)
tree6f4efb0338b2f1f28a0530f5a48db7af2d8f8866 /Src/Modules/zftp.c
parent51d2e91a7e0f3823fc7b689c7bada4230444729e (diff)
downloadzsh-5ca680c93cb28c6616cc8f82db80a2425685dc38.tar.gz
zsh-5ca680c93cb28c6616cc8f82db80a2425685dc38.tar.xz
zsh-5ca680c93cb28c6616cc8f82db80a2425685dc38.zip
44162 (tweaked): Avoid format-overflow warning in zftp.c
Diffstat (limited to 'Src/Modules/zftp.c')
-rw-r--r--Src/Modules/zftp.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/Src/Modules/zftp.c b/Src/Modules/zftp.c
index 4aaa1f072..adf35b69e 100644
--- a/Src/Modules/zftp.c
+++ b/Src/Modules/zftp.c
@@ -1257,14 +1257,8 @@ zfstats(char *fnam, int remote, off_t *retsize, char **retmdtm, int fd)
 	if (retmdtm) {
 	    /* use gmtime() rather than localtime() for consistency */
 	    tm = gmtime(&statbuf.st_mtime);
-	    /*
-	     * FTP format for data is YYYYMMDDHHMMSS
-	     * Using tm directly is easier than worrying about
-	     * incompatible strftime()'s.
-	     */
-	    sprintf(tmbuf, "%04d%02d%02d%02d%02d%02d",
-		    tm->tm_year + 1900, tm->tm_mon+1, tm->tm_mday,
-		    tm->tm_hour, tm->tm_min, tm->tm_sec);
+	    /* FTP format for date is YYYYMMDDHHMMSS */
+	    ztrftime(tmbuf, sizeof(tmbuf), "%Y%m%d%H%M%S", tm, 0L);
 	    mt = ztrdup(tmbuf);
 	}
     }