summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-03-21 11:30:14 -0700
committerJunio C Hamano <gitster@pobox.com>2018-03-21 11:30:14 -0700
commit4c5dbf1c142e8fd8a58af461412a10d511eb4691 (patch)
treee9aa7cec0b6d8fc328b91ecb77573516ece2b495
parente2a37ec2b03456bc9131f7c1fe68e1742bf28953 (diff)
parent9ee0540a40988cf56611a341232dcb5bed6d1f06 (diff)
downloadgit-4c5dbf1c142e8fd8a58af461412a10d511eb4691.tar.gz
Merge branch 'js/ming-strftime'
* js/ming-strftime: mingw: abort on invalid strftime formats
-rw-r--r--compat/mingw.c11
-rw-r--r--compat/mingw.h3
2 files changed, 14 insertions, 0 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index 2d44d21aca..a67872babf 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -761,6 +761,17 @@ revert_attrs:
return rc;
}
+#undef strftime
+size_t mingw_strftime(char *s, size_t max,
+ const char *format, const struct tm *tm)
+{
+ size_t ret = strftime(s, max, format, tm);
+
+ if (!ret && errno == EINVAL)
+ die("invalid strftime format: '%s'", format);
+ return ret;
+}
+
unsigned int sleep (unsigned int seconds)
{
Sleep(seconds*1000);
diff --git a/compat/mingw.h b/compat/mingw.h
index e03aecfe2e..571019d0bd 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -361,6 +361,9 @@ int mingw_fstat(int fd, struct stat *buf);
int mingw_utime(const char *file_name, const struct utimbuf *times);
#define utime mingw_utime
+size_t mingw_strftime(char *s, size_t max,
+ const char *format, const struct tm *tm);
+#define strftime mingw_strftime
pid_t mingw_spawnvpe(const char *cmd, const char **argv, char **env,
const char *dir,