diff options
author | Thomas Haller <thaller@redhat.com> | 2015-08-19 22:47:18 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2015-08-19 23:36:36 +0200 |
commit | 4c80e322ae1e2ab9c4e64fc0902dd90e76c43f43 (patch) | |
tree | 34c2c176b57e0bb0309724d5c108632c23fdfb94 | |
parent | 388dc12b20c646c1681b098d660aee182a043ddf (diff) | |
download | NetworkManager-4c80e322ae1e2ab9c4e64fc0902dd90e76c43f43.tar.gz |
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.
-rw-r--r-- | callouts/nm-dispatcher-utils.c | 2 | ||||
-rw-r--r-- | 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; |