Browse Source

Merge branch 'js/ming-strftime'

* js/ming-strftime:
  mingw: abort on invalid strftime formats
maint
Junio C Hamano 7 years ago
parent
commit
4c5dbf1c14
  1. 11
      compat/mingw.c
  2. 3
      compat/mingw.h

11
compat/mingw.c

@ -761,6 +761,17 @@ revert_attrs: @@ -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);

3
compat/mingw.h

@ -361,6 +361,9 @@ int mingw_fstat(int fd, struct stat *buf); @@ -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,

Loading…
Cancel
Save