Xinqi Bao's Git
projects
/
slstatus.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
Unify header includes
[slstatus.git]
/
components
/
datetime.c
diff --git
a/components/datetime.c
b/components/datetime.c
index
0816923
..
12d7717
100644
(file)
--- a/
components/datetime.c
+++ b/
components/datetime.c
@@
-1,4
+1,5
@@
/* See LICENSE file for copyright and license details. */
/* See LICENSE file for copyright and license details. */
+#include <stdio.h>
#include <time.h>
#include "../util.h"
#include <time.h>
#include "../util.h"
@@
-9,8
+10,10
@@
datetime(const char *fmt)
time_t t;
t = time(NULL);
time_t t;
t = time(NULL);
- if (strftime(buf, sizeof(buf), fmt, localtime(&t)) == 0)
+ if (!strftime(buf, sizeof(buf), fmt, localtime(&t))) {
+ fprintf(stderr, "strftime: Result string exceeds buffer size\n");
return NULL;
return NULL;
+ }
return buf;
}
return buf;
}