Commit da3c5b4e authored by npzacs's avatar npzacs
Browse files

Fixed segfault when BD_DEBUG_FILE can't be opened

parent e7aa4fd4
......@@ -52,8 +52,13 @@ void aacs_debug(const char *file, int line, uint32_t mask, const char *format, .
// Send DEBUG to file?
if ((env = getenv("BD_DEBUG_FILE"))) {
logfile = fopen(env, "wb");
setvbuf(logfile, NULL, _IOLBF, 0);
FILE *fp = fopen(env, "wb");
if (fp) {
logfile = fp;
setvbuf(logfile, NULL, _IOLBF, 0);
} else {
fprintf(logfile, "%s:%d: Error opening log file %s\n", __FILE__, __LINE__, env);
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment