diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2022-10-03 13:46:02 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2022-10-04 10:06:54 +0200 |
commit | 5cf9395b94f68c701101207a1eb964eb565be55d (patch) | |
tree | 7d3913c8e76c459b4af2973eb8007e4d323639ca | |
parent | 88f5e7518a6451708ec8dd04373a3f2a045e4dab (diff) | |
download | NetworkManager-5cf9395b94f68c701101207a1eb964eb565be55d.tar.gz |
nmcli: fix return code on "nmcli device connect" error
Before:
$ nmcli device connect veth0; echo $?
Error: Connection activation failed: (5) IP configuration could not be reserved (no available address, timeout, etc.).
0
After
$ nmcli device connect veth0; echo $?
Error: Connection activation failed: (5) IP configuration could not be reserved (no available address, timeout, etc.).
4
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/902
-rw-r--r-- | src/nmcli/devices.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/nmcli/devices.c b/src/nmcli/devices.c index dbba6bb61c..7b70fa1645 100644 --- a/src/nmcli/devices.c +++ b/src/nmcli/devices.c @@ -2132,9 +2132,11 @@ connected_state_cb(AddAndActivateInfo *info) _("Hint: \"nmcli dev wifi show-password\" shows the Wi-Fi name and password.\n")); } else if (state <= NM_DEVICE_STATE_DISCONNECTED || state >= NM_DEVICE_STATE_DEACTIVATING) { reason = nm_device_get_state_reason(info->device); - g_print(_("Error: Connection activation failed: (%d) %s.\n"), - reason, - gettext(nmc_device_reason_to_string(reason))); + g_string_printf(info->nmc->return_text, + _("Error: Connection activation failed: (%d) %s."), + reason, + gettext(nmc_device_reason_to_string(reason))); + info->nmc->return_value = NMC_RESULT_ERROR_CON_ACTIVATION; } else { return; } |