From 52edf15cece7d4c297d75235d521f8fb883a96cc Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Thu, 5 Nov 2015 08:57:56 +0100 Subject: [PATCH] CID 22438 Unchecked return value from library --- src/reports.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/reports.c b/src/reports.c index 78518a9ce..45ed7e75f 100644 --- a/src/reports.c +++ b/src/reports.c @@ -1547,14 +1547,18 @@ int write_reports(faction * f, time_t ltime) struct report_context ctx; const char *encoding = "UTF-8"; report_type *rtype; + const char *path = reportpath();; if (noreports) { return false; } prepare_report(&ctx, f); get_addresses(&ctx); - if (_access(reportpath(), 0) < 0) { - _mkdir(reportpath()); + if (_access(path, 0) < 0) { + if (_mkdir(path) != 0) { + log_error("could not create reports directory %s: %s", path, strerror(errno)); + abort(); + } } if (errno) { log_warning("errno was %d before writing reports", errno);