summaryrefslogtreecommitdiff
path: root/src/bootchart/bootchart.c
diff options
context:
space:
mode:
authorThomas Hindoe Paaboel Andersen <phomes@gmail.com>2014-09-27 22:25:07 +0200
committerThomas Hindoe Paaboel Andersen <phomes@gmail.com>2014-09-28 14:46:38 +0200
commite931d3f4241231e4102eda06adaf7cbfd68c6a5d (patch)
tree7ff5eb21ee1bea1ed260726164f70a10e528027c /src/bootchart/bootchart.c
parent9bcf7507fab6e6b022ae3cc7178237e6e0a09e9a (diff)
bootchart: check return of strftime
Found by coverity. Fixes: CID#996314 and #996312
Diffstat (limited to 'src/bootchart/bootchart.c')
-rw-r--r--src/bootchart/bootchart.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/bootchart/bootchart.c b/src/bootchart/bootchart.c
index 8ef5ad18a6..366a5ab5d0 100644
--- a/src/bootchart/bootchart.c
+++ b/src/bootchart/bootchart.c
@@ -389,7 +389,9 @@ int main(int argc, char *argv[]) {
if (!of && (access(arg_output_path, R_OK|W_OK|X_OK) == 0)) {
t = time(NULL);
- strftime(datestr, sizeof(datestr), "%Y%m%d-%H%M", localtime(&t));
+ r = strftime(datestr, sizeof(datestr), "%Y%m%d-%H%M", localtime(&t));
+ assert_se(r > 0);
+
snprintf(output_file, PATH_MAX, "%s/bootchart-%s.svg", arg_output_path, datestr);
of = fopen(output_file, "we");
}
@@ -457,7 +459,9 @@ int main(int argc, char *argv[]) {
if (!of) {
t = time(NULL);
- strftime(datestr, sizeof(datestr), "%Y%m%d-%H%M", localtime(&t));
+ r = strftime(datestr, sizeof(datestr), "%Y%m%d-%H%M", localtime(&t));
+ assert_se(r > 0);
+
snprintf(output_file, PATH_MAX, "%s/bootchart-%s.svg", arg_output_path, datestr);
of = fopen(output_file, "we");
}