No longer report an error for empty format strings

This commit is contained in:
Pierre Pronchery 2014-05-06 01:44:49 +02:00
parent ea8d4d36bb
commit 3aa9992bf7

View File

@ -41,7 +41,7 @@ static int _date(char const * format)
return -_date_error("time", 1);
if(localtime_r(&t, &tm) == NULL)
return -_date_error("localtime_r", 1);
if(strftime(buf, sizeof(buf), format, &tm) == 0)
if(strftime(buf, sizeof(buf), format, &tm) == 0 && format[0] != '\0')
return -_date_error("strftime", 1);
puts(buf);
return 0;