1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-04 20:40:57 +02:00

44162 (tweaked): Avoid format-overflow warning in zftp.c

This commit is contained in:
Wesley Schwengle 2019-03-25 23:01:43 +09:00 committed by Jun-ichi Takimoto
parent 51d2e91a7e
commit 5ca680c93c
2 changed files with 5 additions and 8 deletions

View file

@ -1,5 +1,8 @@
2019-03-25 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
* Wesley Schwengle: 44162 (tweaked): Src/Modules/zftp.c: Avoid
format-overflow warning by using ztrftime()
* Wesley Schwengle: 44164: Src/params.c: Avoid stringop-truncation
warning by replacing strncpy() by memcpy()

View file

@ -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);
}
}