From a08aa50f9282b9e58a00f1fd23389e5e5186de9f Mon Sep 17 00:00:00 2001 From: Christian Kruse Date: Thu, 16 Jan 2014 16:01:58 +0100 Subject: [PATCH] fix: close stdin and stdout only in repmgrd closing stdin and stdout might cause problems when using system(), so we avoid it. --- log.c | 3 --- repmgrd.c | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/log.c b/log.c index aa953318..b2e95faa 100644 --- a/log.c +++ b/log.c @@ -140,9 +140,6 @@ bool logger_init(t_configuration_options *opts, const char* ident, const char* l #endif - fclose(stdin); - fclose(stdout); - if (*opts->logfile) { freopen(opts->logfile, "a", stderr); diff --git a/repmgrd.c b/repmgrd.c index e5191d48..bd80c5ed 100644 --- a/repmgrd.c +++ b/repmgrd.c @@ -272,6 +272,9 @@ main(int argc, char **argv) exit(ERR_BAD_CONFIG); } + fclose(stdin); + fclose(stdout); + logger_init(&local_options, progname, local_options.loglevel, local_options.logfacility); if (verbose) logger_min_verbose(LOG_INFO);