diff options
| author | Michael Biebl <biebl@debian.org> | 2020-05-08 21:41:46 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2020-05-08 21:41:46 +0200 |
| commit | 14a437f08bfacbdbe3ed3d4e36dcf8a199df8e9e (patch) | |
| tree | 036108c3f080f94e794f52be66cc2bab2158486e /dispatcher | |
| parent | 9df39b936fcb2f3d27ff7e653e645c16900807e3 (diff) | |
| parent | d460892bbfece74fb6d3cd846bf6ef548290be41 (diff) | |
Update upstream source from tag 'upstream/1.24.0'
Update to upstream version '1.24.0' with Debian dir 36f1778d11d8b638b63bd623816627ac76cb75ee
Diffstat (limited to 'dispatcher')
| -rw-r--r-- | dispatcher/nm-dispatcher.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/dispatcher/nm-dispatcher.c b/dispatcher/nm-dispatcher.c index 27647c1b..e1737d85 100644 --- a/dispatcher/nm-dispatcher.c +++ b/dispatcher/nm-dispatcher.c @@ -482,7 +482,7 @@ check_filename (const char *file_name) static gboolean script_dispatch (ScriptInfo *script) { - GError *error = NULL; + gs_free_error GError *error = NULL; char *argv[4]; Request *request = script->request; @@ -491,27 +491,30 @@ script_dispatch (ScriptInfo *script) script->dispatched = TRUE; + /* Only for "hostname" action we coerce the interface name to "none". We don't + * do so for "connectivity-check" action. */ + argv[0] = script->script; - argv[1] = request->iface ?: (!strcmp(request->action, NMD_ACTION_HOSTNAME) ? "none" : ""); + argv[1] = request->iface + ?: (nm_streq (request->action, NMD_ACTION_HOSTNAME) ? "none" : ""); argv[2] = request->action; argv[3] = NULL; _LOG_S_T (script, "run script%s", script->wait ? "" : " (no-wait)"); - if (g_spawn_async ("/", argv, request->envp, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &script->pid, &error)) { - script->watch_id = g_child_watch_add (script->pid, (GChildWatchFunc) script_watch_cb, script); - script->timeout_id = g_timeout_add_seconds (SCRIPT_TIMEOUT, script_timeout_cb, script); - if (!script->wait) - request->num_scripts_nowait++; - return TRUE; - } else { + if (!g_spawn_async ("/", argv, request->envp, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &script->pid, &error)) { _LOG_S_W (script, "complete: failed to execute script: %s", error->message); script->result = DISPATCH_RESULT_EXEC_FAILED; script->error = g_strdup (error->message); request->num_scripts_done++; - g_clear_error (&error); return FALSE; } + + script->watch_id = g_child_watch_add (script->pid, (GChildWatchFunc) script_watch_cb, script); + script->timeout_id = g_timeout_add_seconds (SCRIPT_TIMEOUT, script_timeout_cb, script); + if (!script->wait) + request->num_scripts_nowait++; + return TRUE; } static gboolean |