[git commit] libbb: fix time parsing of [[CC]YY]MMDDhhmm[.SS]. Closes 8951

Denys Vlasenko vda.linux at googlemail.com
Tue May 31 00:50:54 UTC 2016


commit: https://git.busybox.net/busybox/commit/?id=b684d1b1864ba9d7968de5565823f8e42f1dc448
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

If SS is not given a value, it is assumed to be zero.
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/touch.html

Signed-off-by: Natanael Copa <ncopa at alpinelinux.org>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 libbb/time.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libbb/time.c b/libbb/time.c
index aa19a47..82e6cb1 100644
--- a/libbb/time.c
+++ b/libbb/time.c
@@ -186,6 +186,7 @@ void FAST_FUNC parse_datestr(const char *date_str, struct tm *ptm)
 		} else {
 			bb_error_msg_and_die(bb_msg_invalid_date, date_str);
 		}
+		ptm->tm_sec = 0; /* assume zero if [.SS] is not given */
 		if (end == '.') {
 			/* xxx.SS */
 			if (sscanf(strchr(date_str, '.') + 1, "%u%c",


More information about the busybox-cvs mailing list