From 4c80e322ae1e2ab9c4e64fc0902dd90e76c43f43 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 19 Aug 2015 22:47:18 +0200 Subject: [PATCH] dispatcher: explicitly set missing interface argument for device actions The first argument for dispatcher actions is the interface name, except for the "hostname" action, where no interface is available. For "hostname" actions continue to pass "none", as there is no interface available. But for device actions, it may happen that the interface name is missing too. In this case, don't pass "none" but instead an empty name. --- callouts/nm-dispatcher-utils.c | 2 +- callouts/nm-dispatcher.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/callouts/nm-dispatcher-utils.c b/callouts/nm-dispatcher-utils.c index 52eddfdab6..bbd0e49016 100644 --- a/callouts/nm-dispatcher-utils.c +++ b/callouts/nm-dispatcher-utils.c @@ -349,7 +349,7 @@ nm_dispatcher_utils_construct_envp (const char *action, g_return_val_if_fail (*out_iface == NULL, NULL); /* Hostname changes don't require a device nor contain a connection */ - if (!strcmp (action, "hostname")) + if (!strcmp (action, NMD_ACTION_HOSTNAME)) goto done; /* Connection properties */ diff --git a/callouts/nm-dispatcher.c b/callouts/nm-dispatcher.c index 32b60e8a29..3cb50b5790 100644 --- a/callouts/nm-dispatcher.c +++ b/callouts/nm-dispatcher.c @@ -372,7 +372,9 @@ dispatch_one_script (Request *request) ScriptInfo *script = g_ptr_array_index (request->scripts, request->idx); argv[0] = script->script; - argv[1] = request->iface ? request->iface : "none"; + argv[1] = request->iface + ? request->iface + : (!strcmp (request->action, NMD_ACTION_HOSTNAME) ? "none" : ""); argv[2] = request->action; argv[3] = NULL;