Fix build failures

The freopen return value caused warnings.
This commit is contained in:
Markus Mäkelä 2018-10-18 02:06:58 +03:00
parent 192563a947
commit 262f1d7e47
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -576,8 +576,11 @@ static bool logmanager_init_nomutex(const char* ident,
if (redirect_stdout)
{
// Redirect stdout and stderr to the log file
freopen(lm->lm_logfile.lf_full_file_name, "a", stdout);
freopen(lm->lm_logfile.lf_full_file_name, "a", stderr);
if (!freopen(lm->lm_logfile.lf_full_file_name, "a", stdout) ||
!freopen(lm->lm_logfile.lf_full_file_name, "a", stderr))
{
fprintf(stderr, "Error: Failed to redirect stdout/stderr to log file.\n");
}
}
return_succ:
@ -2166,8 +2169,12 @@ static bool thr_flush_file(logmanager_t *lm, filewriter_t *fwr)
else if (redirect_stdout)
{
// Redirect stdout and stderr to the new log file
freopen(lf->lf_full_file_name, "a", stdout);
freopen(lf->lf_full_file_name, "a", stderr);
if (!freopen(lf->lf_full_file_name, "a", stdout) ||
!freopen(lf->lf_full_file_name, "a", stderr))
{
LOG_ERROR("MaxScale Log: Error, could not redirect stdout/stderr to log file %s.\n",
lf->lf_full_file_name);
}
}
}