[pgpool-committers: 48] pgpool: Fix up hangup during md5 authentication that occurs in daemon m

Yugo Nagata nagata at sraoss.co.jp
Tue Feb 14 15:57:56 JST 2012

Fix up hangup during md5 authentication that occurs in daemon mode and
log_destination is 'syslog'. (reported in [pgpool-hackers: 25]).

Before daemonizing, openlog() opens syslog connection socket and gets
a file descriptor (fd). Then in daemonizing process, the fd is closed
as well as others. After daemonizing, pool_passwd is opened for md5
authentication and the same fd is assigned. In md5 authentication process,
syslog() is called for logging. However it fails since the used fd is
not for socket but for file. So, syslog() closed the fd and reopen new
socket using the same fd again. Then in trying to read pool_passwd, it
fails because the using fd is not for the pool_passwd file but for syslog
connection socket and then gets hangup.

Fix the problem by calling closelog() to close syslog connection safely
before daemonizing and calling openlog() to reopen syslog connection
after daemonizing.



Modified Files
main.c |   10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)

More information about the pgpool-committers mailing list