From: Roy Marples Date: Wed, 14 May 2008 11:44:01 +0000 (+0000) Subject: Export the parent pid to the script. X-Git-Tag: v4.0.2~408 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf6c0cfe0c1fd556f3b9353e36346946d91cac55;p=thirdparty%2Fdhcpcd.git Export the parent pid to the script. --- diff --git a/configure.c b/configure.c index 2db43978..cd241dfc 100644 --- a/configure.c +++ b/configure.c @@ -65,7 +65,7 @@ exec_script(const char *script, const char *iface, const char *reason, logger(LOG_DEBUG, "exec `%s'", script); /* Make our env */ - elen = 3; + elen = 4; env = xmalloc(sizeof(char *) * (elen + 1)); path = getenv("PATH"); if (path) { @@ -80,6 +80,9 @@ exec_script(const char *script, const char *iface, const char *reason, e = strlen("reason") + strlen(reason) + 2; env[2] = xmalloc(e); snprintf(env[2], e, "reason=%s", reason); + e = 20; + env[3] = xmalloc(e); + snprintf(env[3], e, "pid=%d", getpid()); if (dhcpo) { e = configure_env(NULL, NULL, dhcpo); if (e > 0) { diff --git a/dhcpcd.sh.in b/dhcpcd.sh.in index c5df4e77..7e080254 100644 --- a/dhcpcd.sh.in +++ b/dhcpcd.sh.in @@ -104,7 +104,7 @@ set_hostname() run_test() { - env | grep "^\(interface\|reason\)=" + env | grep "^\(interface\|pid\|reason\)=" env | grep "^\(new_\|old_\)" | sort }