pgpool2.git / summary / log / commit / refs
commit 3c2cb002ff2d44f29416473dae5cc9e05c41aa4f
Author: Yugo Nagata <nagata@sraoss.co.jp>
Date: Mon Apr 21 05:58:13 2014 +0000
Fix to ignore a harmless error code when executing ifconfig command
When executing command such as ifconfig or ping by execv() in a forked
child proess, wait() can fails with an error code ECHILD, although the
process exists exactly, if SIGCHLD is set to SIG_IGN in Linux. We should
ignore this and not treat as failure of the command.
src/watchdog/wd_if.c | 4 ++--
src/watchdog/wd_ping.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/watchdog/wd_if.c b/src/watchdog/wd_if.c
index 9f60acabb..0976655ee 100644
--- a/src/watchdog/wd_if.c
+++ b/src/watchdog/wd_if.c
@@ -224,12 +224,12 @@ exec_ifconfig(char * path,char * command)
{
int result;
result = wait(&status);
- if (result < 0)
+ if (result < 0 && errno != ECHILD)
{
if (errno == EINTR)
continue;
- pool_debug("exec_ifconfig: wait() failed at errno: %d ", errno);
+ pool_debug("exec_ifconfig: wait() failed. reason: %s ", strerror(errno));
return WD_NG;
}
diff --git a/src/watchdog/wd_ping.c b/src/watchdog/wd_ping.c
index cd84bfc78..714dd914e 100644
--- a/src/watchdog/wd_ping.c
+++ b/src/watchdog/wd_ping.c
@@ -226,7 +226,7 @@ exec_ping(void * arg)
{
int r;
r = waitpid(pid, &status, 0);
- if (r < 0)
+ if (r < 0 && errno == ECHILD)
{
if (errno == EINTR)
continue;
[parent: 954eaa2d3189]