avoid call of fwrite with size of zero; retype result

SCCS-file: date.c
SCCS-SID: 3.6
This commit is contained in:
Arthur David Olson
2012-07-18 03:01:56 -04:00
committed by Paul Eggert
parent 30eae305f8
commit 6928ce3ab5
+4 -2
View File
@@ -529,10 +529,12 @@ char * format;
tm * tmp;
{
char buf[1024];
int result;
size_t result;
if (*format == '\0')
return;
result = strftime(buf, sizeof buf, format, tmp);
if (result == 0 && *format != '\0') {
if (result == 0) {
(void) fprintf(stderr,
"date: error: strftime: result is too long\n");
errensure();