Merge branch 'mingw-strftime'

This topic branch works around an out-of-memory bug when the user
specified a format via --date=format:<format> that strftime() does
not like.

Reported by Stefan Naewe.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2018-02-16 22:08:08 +01:00
2 changed files with 14 additions and 0 deletions

View File

@@ -931,6 +931,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);

View File

@@ -446,6 +446,9 @@ extern int (*lstat)(const char *file_name, 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,