mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-14 20:18:39 +00:00
core,nm-dispatcher: use nm_utils_get_process_exit_status_desc()
This commit is contained in:
parent
517852dccd
commit
326dde6d53
|
@ -517,20 +517,12 @@ daemon_watch_cb(GPid pid, int status, gpointer user_data)
|
|||
{
|
||||
NMDhcpClient * self = NM_DHCP_CLIENT(user_data);
|
||||
NMDhcpClientPrivate *priv = NM_DHCP_CLIENT_GET_PRIVATE(self);
|
||||
gs_free char * desc = NULL;
|
||||
|
||||
g_return_if_fail(priv->watch_id);
|
||||
priv->watch_id = 0;
|
||||
|
||||
if (WIFEXITED(status))
|
||||
_LOGI("client pid %d exited with status %d", pid, WEXITSTATUS(status));
|
||||
else if (WIFSIGNALED(status))
|
||||
_LOGI("client pid %d killed by signal %d", pid, WTERMSIG(status));
|
||||
else if (WIFSTOPPED(status))
|
||||
_LOGI("client pid %d stopped by signal %d", pid, WSTOPSIG(status));
|
||||
else if (WIFCONTINUED(status))
|
||||
_LOGI("client pid %d resumed (by SIGCONT)", pid);
|
||||
else
|
||||
_LOGW("client died abnormally");
|
||||
_LOGI("client pid %d %s", pid, (desc = nm_utils_get_process_exit_status_desc(status)));
|
||||
|
||||
priv->pid = -1;
|
||||
|
||||
|
|
|
@ -361,8 +361,8 @@ complete_script(ScriptInfo *script)
|
|||
static void
|
||||
script_watch_cb(GPid pid, int status, gpointer user_data)
|
||||
{
|
||||
ScriptInfo *script = user_data;
|
||||
guint err;
|
||||
ScriptInfo * script = user_data;
|
||||
gs_free char *status_desc = NULL;
|
||||
|
||||
g_assert(pid == script->pid);
|
||||
|
||||
|
@ -372,23 +372,11 @@ script_watch_cb(GPid pid, int status, gpointer user_data)
|
|||
if (!script->wait)
|
||||
script->request->num_scripts_nowait--;
|
||||
|
||||
if (WIFEXITED(status)) {
|
||||
err = WEXITSTATUS(status);
|
||||
if (err == 0)
|
||||
script->result = DISPATCH_RESULT_SUCCESS;
|
||||
else {
|
||||
script->error =
|
||||
g_strdup_printf("Script '%s' exited with error status %d.", script->script, err);
|
||||
}
|
||||
} else if (WIFSTOPPED(status)) {
|
||||
script->error = g_strdup_printf("Script '%s' stopped unexpectedly with signal %d.",
|
||||
script->script,
|
||||
WSTOPSIG(status));
|
||||
} else if (WIFSIGNALED(status)) {
|
||||
script->error =
|
||||
g_strdup_printf("Script '%s' died with signal %d", script->script, WTERMSIG(status));
|
||||
if (WIFEXITED(status) && WEXITSTATUS(status) == 0) {
|
||||
script->result = DISPATCH_RESULT_SUCCESS;
|
||||
} else {
|
||||
script->error = g_strdup_printf("Script '%s' died from an unknown cause", script->script);
|
||||
status_desc = nm_utils_get_process_exit_status_desc(status);
|
||||
script->error = g_strdup_printf("Script '%s' %s.", script->script, status_desc);
|
||||
}
|
||||
|
||||
if (script->result == DISPATCH_RESULT_SUCCESS) {
|
||||
|
|
Loading…
Reference in a new issue