From: Roy Marples Date: Thu, 6 Mar 2014 09:28:02 +0000 (+0000) Subject: dhcpcd device context is from temporary storage, so copy the struct. X-Git-Tag: v6.3.2~29 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=85d577d9a88735c0447115d7c308bc2b968bd6b7;p=thirdparty%2Fdhcpcd.git dhcpcd device context is from temporary storage, so copy the struct. Thanks to Sergey Kvachonok. --- diff --git a/dev/udev.c b/dev/udev.c index 57c27cd6..2c6b9eae 100644 --- a/dev/udev.c +++ b/dev/udev.c @@ -44,7 +44,7 @@ static const char udev_name[]="udev"; static struct udev *udev; static struct udev_monitor *monitor; -static const struct dev_dhcpcd *dhcpcd; +static struct dev_dhcpcd dhcpcd; static int udev_listening(void) @@ -92,9 +92,9 @@ udev_handle_device(void *ctx) if (strcmp(subsystem, "net") == 0) { syslog(LOG_DEBUG, "%s: libudev: %s", ifname, action); if (strcmp(action, "add") == 0 || strcmp(action, "move") == 0) - dhcpcd->handle_interface(ctx, 1, ifname); + dhcpcd.handle_interface(ctx, 1, ifname); else if (strcmp(action, "remove") == 0) - dhcpcd->handle_interface(ctx, -1, ifname); + dhcpcd.handle_interface(ctx, -1, ifname); } udev_device_unref(device); @@ -173,7 +173,7 @@ dev_init(struct dev *dev, const struct dev_dhcpcd *dev_dhcpcd) dev->stop = udev_stop; dev->start = udev_start; - dhcpcd = dev_dhcpcd; + dhcpcd = *dev_dhcpcd; return 0; }