mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-25 08:06:29 +00:00
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:
9
log.c
9
log.c
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user