From 02278d3b8f594df7471f91ff8d2736f3bad97e47 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Fri, 26 Feb 2016 13:30:56 +0100 Subject: [PATCH] arping-manager: failure to get a device name should not be fatal The device could just be removed mid-flight. --- src/devices/nm-arping-manager.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/devices/nm-arping-manager.c b/src/devices/nm-arping-manager.c index ea10609f21..dfb20b4b51 100644 --- a/src/devices/nm-arping-manager.c +++ b/src/devices/nm-arping-manager.c @@ -193,7 +193,12 @@ nm_arping_manager_start_probe (NMArpingManager *self, guint timeout, GError **er g_return_val_if_fail (priv->state == STATE_INIT, FALSE); argv[4] = nm_platform_link_get_name (NM_PLATFORM_GET, priv->ifindex); - g_return_val_if_fail (argv[4], FALSE); + if (!argv[4]) { + /* The device was probably just removed. */ + g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_FAILED, + "can't find a name for ifindex %d", priv->ifindex); + return FALSE; + } priv->completed = 0; @@ -306,7 +311,11 @@ send_announcements (NMArpingManager *self, const char *mode_arg) AddressInfo *info; argv[4] = nm_platform_link_get_name (NM_PLATFORM_GET, priv->ifindex); - g_return_if_fail (argv[4]); + if (!argv[4]) { + /* The device was probably just removed. */ + _LOGW ("can't find a name for ifindex %d", priv->ifindex); + return; + } argv[0] = nm_utils_find_helper ("arping", NULL, NULL); if (!argv[0]) {