From: Junio C Hamano Date: Tue, 20 Mar 2018 21:22:48 +0000 (-0700) Subject: Merge branch 'js/ming-strftime' into next X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/a9ca8172c746cd4a9abf15fee37935caa81b27e9?hp=317e077588bd945c6bd29d5ead554f6be2a262c0 Merge branch 'js/ming-strftime' into next * js/ming-strftime: mingw: abort on invalid strftime formats --- 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 @@ int mingw_utime (const char *file_name, const struct utimbuf *times) 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,