CID 22438 Unchecked return value from library

This commit is contained in:
Enno Rehling 2015-11-05 08:57:56 +01:00
parent 64e8d4b094
commit 52edf15cec
1 changed files with 6 additions and 2 deletions

View File

@ -1547,14 +1547,18 @@ int write_reports(faction * f, time_t ltime)
struct report_context ctx; struct report_context ctx;
const char *encoding = "UTF-8"; const char *encoding = "UTF-8";
report_type *rtype; report_type *rtype;
const char *path = reportpath();;
if (noreports) { if (noreports) {
return false; return false;
} }
prepare_report(&ctx, f); prepare_report(&ctx, f);
get_addresses(&ctx); get_addresses(&ctx);
if (_access(reportpath(), 0) < 0) { if (_access(path, 0) < 0) {
_mkdir(reportpath()); if (_mkdir(path) != 0) {
log_error("could not create reports directory %s: %s", path, strerror(errno));
abort();
}
} }
if (errno) { if (errno) {
log_warning("errno was %d before writing reports", errno); log_warning("errno was %d before writing reports", errno);