Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] Change handrolled strftime to strftime in zftp.c
- X-seq: zsh-workers 44163
- From: Wesley Schwengle <wesleyschwengle@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH] Change handrolled strftime to strftime in zftp.c
- Date: Sat, 23 Mar 2019 11:11:35 +0100
- Cc: Wesley Schwengle <wesley@xxxxxxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ENGSQ8+c9mYvHx8+lO5eJqrHALBnKPSR594FmINUss0=; b=L19iT7LfkkrokirV76xKCxQpQHKpbWeQbMpa9dkqPSpE3UbR4D9T/BQMm9NUAN/rCO kdpN/Pzxcn+/LPw96bh5pgPNt/x7bRNZGut+Rqb3CYLmy6zDVS9NHjExlD5DA1F/7wWh 4CNnbv/CjmJFketRadznEl+ZdwR1z0wyv4aa1BYxMcOlKi5SFbuMAqJ1QUdICHDKJuQw 4Kg/nmb0cnG3oXfR+grrtU9XJ5Jv/UeRyTTCf8adhXbOmj2PN8bGwySF0lL5L21bmal3 QGUXHJPF/OvR8PdQ9bHd6br9oLhfQ9Isa6zwa/qbKtmFoj1BtVOlr6lhgMmJAouVNFTn FXWg==
- In-reply-to: <20190323101135.14344-1-wesley@mintlab.nl>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20190323101135.14344-1-wesley@mintlab.nl>
From: Wesley Schwengle <wesley@xxxxxxxxxxxxx>
Compiling zsh on Debian testing/unstable with cc (Debian 8.3.0-2) 8.3.0
emits a -Wformat-overflow= warning on line 1265 in zftp.c. Replace the
code with strftime() resolves it.
Signed-off-by: Wesley Schwengle <wesley@xxxxxxxxxxxxx>
---
Src/Modules/zftp.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/Src/Modules/zftp.c b/Src/Modules/zftp.c
index 4aaa1f072..e0789216a 100644
--- a/Src/Modules/zftp.c
+++ b/Src/Modules/zftp.c
@@ -1257,14 +1257,7 @@ 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);
+ strftime(tmbuf, 15, "%Y%m%d%H%M%S", tm);
mt = ztrdup(tmbuf);
}
}
--
2.21.0.196.g041f5ea1cf
Messages sorted by:
Reverse Date,
Date,
Thread,
Author