]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix compile on Linux for dev support.
authorRoy Marples <roy@marples.name>
Fri, 24 Mar 2017 13:29:50 +0000 (13:29 +0000)
committerRoy Marples <roy@marples.name>
Fri, 24 Mar 2017 13:29:50 +0000 (13:29 +0000)
src/dev.c

index 210f12f0da7f5b1a0296b2a9e64db29dfdd27929..c9ae656ed59e3eb25aaeb23c1e8c097d5192b21d 100644 (file)
--- a/src/dev.c
+++ b/src/dev.c
@@ -28,6 +28,7 @@
 #include <dlfcn.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <syslog.h>
 #include <string.h>
 
 #define _INDEV
@@ -60,8 +61,7 @@ dev_stop1(struct dhcpcd_ctx *ctx, int stop)
 
        if (ctx->dev) {
                if (stop)
-                       logger(ctx, LOG_DEBUG,
-                           "dev: unloaded %s", ctx->dev->name);
+                       syslog(LOG_DEBUG, "dev: unloaded %s", ctx->dev->name);
                eloop_event_delete(ctx->eloop, ctx->dev_fd);
                ctx->dev->stop();
                free(ctx->dev);
@@ -93,18 +93,18 @@ dev_start2(struct dhcpcd_ctx *ctx, const char *name)
        snprintf(file, sizeof(file), DEVDIR "/%s", name);
        h = dlopen(file, RTLD_LAZY);
        if (h == NULL) {
-               logger(ctx, LOG_ERR, "dlopen: %s", dlerror());
+               syslog(LOG_ERR, "dlopen: %s", dlerror());
                return -1;
        }
        fptr = (void (*)(struct dev *, const struct dev_dhcpcd *))
            dlsym(h, "dev_init");
        if (fptr == NULL) {
-               logger(ctx, LOG_ERR, "dlsym: %s", dlerror());
+               syslog(LOG_ERR, "dlsym: %s", dlerror());
                dlclose(h);
                return -1;
        }
        if ((ctx->dev = calloc(1, sizeof(*ctx->dev))) == NULL) {
-               logger(ctx, LOG_ERR, "%s: calloc: %m", __func__);
+               syslog(LOG_ERR, "%s: calloc: %m", __func__);
                dlclose(h);
                return -1;
        }
@@ -116,7 +116,7 @@ dev_start2(struct dhcpcd_ctx *ctx, const char *name)
                dlclose(h);
                return -1;
        }
-       logger(ctx, LOG_INFO, "dev: loaded %s", ctx->dev->name);
+       syslog(LOG_INFO, "dev: loaded %s", ctx->dev->name);
        ctx->dev_handle = h;
        return r;
 }
@@ -129,7 +129,7 @@ dev_start1(struct dhcpcd_ctx *ctx)
        int r;
 
        if (ctx->dev) {
-               logger(ctx, LOG_ERR, "dev: already started %s", ctx->dev->name);
+               syslog(LOG_ERR, "dev: already started %s", ctx->dev->name);
                return -1;
        }
 
@@ -138,7 +138,7 @@ dev_start1(struct dhcpcd_ctx *ctx)
 
        dp = opendir(DEVDIR);
        if (dp == NULL) {
-               logger(ctx, LOG_DEBUG, "dev: %s: %m", DEVDIR);
+               syslog(LOG_DEBUG, "dev: %s: %m", DEVDIR);
                return 0;
        }
 
@@ -171,7 +171,7 @@ dev_start(struct dhcpcd_ctx *ctx)
 {
 
        if (ctx->dev_fd != -1) {
-               logger(ctx, LOG_ERR, "%s: already started on fd %d", __func__,
+               syslog(LOG_ERR, "%s: already started on fd %d", __func__,
                    ctx->dev_fd);
                return ctx->dev_fd;
        }
@@ -181,8 +181,7 @@ dev_start(struct dhcpcd_ctx *ctx)
                if (eloop_event_add(ctx->eloop, ctx->dev_fd,
                    dev_handle_data, ctx) == -1)
                {
-                       logger(ctx, LOG_ERR,
-                           "%s: eloop_event_add: %m", __func__);
+                       syslog(LOG_ERR, "%s: eloop_event_add: %m", __func__);
                        dev_stop1(ctx, 1);
                        return -1;
                }