From: Roy Marples Date: Wed, 26 Nov 2014 14:54:14 +0000 (+0000) Subject: Inform the hooks if we're running with debug or not. X-Git-Tag: v6.6.4~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68f37f540541eac051775ca145710ba68f4bf759;p=thirdparty%2Fdhcpcd.git Inform the hooks if we're running with debug or not. --- diff --git a/dhcpcd-run-hooks.in b/dhcpcd-run-hooks.in index 660435ee..f1f77a86 100644 --- a/dhcpcd-run-hooks.in +++ b/dhcpcd-run-hooks.in @@ -24,6 +24,7 @@ _detected_init=false : ${if_up:=false} : ${if_down:=false} +: ${syslog_debug:=false} # Ensure that all arguments are unique uniqify() @@ -189,6 +190,9 @@ syslog() { local lvl="$1" + if [ "$lvl" = debug ]; then + ${syslog_debug} || return 0 + fi [ -n "$lvl" ] && shift if [ -n "$*" ]; then if type logger >/dev/null 2>&1; then diff --git a/script.c b/script.c index 21c994c4..0f6b360e 100644 --- a/script.c +++ b/script.c @@ -372,6 +372,11 @@ make_env(const struct interface *ifp, const char *reason, char ***argv) env[12] = strdup("if_ipwaited=false"); if (env[12] == NULL) goto eexit; + if (ifo->options & DHCPCD_DEBUG) { + e = strlen("syslog_debug=true") + 1; + EMALLOC(elen, e); + snprintf(env[elen++], e, "syslog_debug=true"); + } if (*ifp->profile) { e = strlen("profile=") + strlen(ifp->profile) + 2; EMALLOC(elen, e);