fix: check return values of freopen()

Some compiles complain about not checking the return value of freopen(),
so we check it
This commit is contained in:
Christian Kruse
2014-03-04 15:32:48 +01:00
parent 50b9022a41
commit 90ecb2b107
2 changed files with 37 additions and 5 deletions

9
log.c
View File

@@ -144,7 +144,14 @@ bool logger_init(t_configuration_options *opts, const char* ident, const char* l
if (*opts->logfile)
{
freopen(opts->logfile, "a", stderr);
FILE *fd;
fd = freopen(opts->logfile, "a", stderr);
if (fd == NULL)
{
fprintf(stderr, "error reopening stderr to '%s': %s",
opts->logfile, strerror(errno));
}
}
return true;