summaryrefslogtreecommitdiffstats
path: root/src/dhcpcd.c
diff options
context:
space:
mode:
authorSergey Nikiforov <Sergey.Nikiforov@kaspersky.com>2020-02-11 11:07:13 +0000
committerRoy Marples <roy@marples.name>2020-02-11 11:07:13 +0000
commita4819e456c7525890a2647775a9b5553b8659a3f (patch)
tree1d9f9a7baae440790de0ea18bba612acab810036 /src/dhcpcd.c
parenteaf099b3e5caaa11b2034ea82fe4c192e81e2ce8 (diff)
downloaddhcpcd-a4819e456c7525890a2647775a9b5553b8659a3f.tar.xz
logerr: Use macros to call log functions
This allows downstream implementions to inject their own data into the log message and/or supply new logging targets whilst preserving macros such as __FILE__ and __LINE__.
Diffstat (limited to 'src/dhcpcd.c')
-rw-r--r--src/dhcpcd.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/dhcpcd.c b/src/dhcpcd.c
index a306bd6f..9bfcdc14 100644
--- a/src/dhcpcd.c
+++ b/src/dhcpcd.c
@@ -48,6 +48,7 @@ const char dhcpcd_copyright[] = "Copyright (c) 2006-2020 Roy Marples";
#include <string.h>
#include <unistd.h>
#include <time.h>
+#include <syslog.h>
#include "config.h"
#include "arp.h"
@@ -2177,11 +2178,11 @@ printpidfile:
}
if (ifp == NULL) {
if (ctx.ifc == 0) {
- logfunc_t *logfunc;
+ int loglevel;
- logfunc = ctx.options & DHCPCD_INACTIVE ?
- logdebugx : logerrx;
- logfunc("no valid interfaces found");
+ loglevel = ctx.options & DHCPCD_INACTIVE ?
+ LOG_DEBUG : LOG_ERR;
+ logmessage(loglevel, "no valid interfaces found");
} else
goto exit_failure;
if (!(ctx.options & DHCPCD_LINK)) {
@@ -2225,11 +2226,11 @@ printpidfile:
ctx.options & DHCPCD_LINK &&
!(ctx.options & DHCPCD_WAITIP))
{
- logfunc_t *logfunc;
+ int loglevel;
- logfunc = ctx.options & DHCPCD_INACTIVE ?
- logdebugx : logwarnx;
- logfunc("no interfaces have a carrier");
+ loglevel = ctx.options & DHCPCD_INACTIVE ?
+ LOG_DEBUG : LOG_WARNING;
+ logmessage(loglevel, "no interfaces have a carrier");
dhcpcd_daemonise(&ctx);
} else if (t > 0 &&
/* Test mode removes the daemonise bit, so check for both */