diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2019-12-23 15:53:30 +0100 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2019-12-23 16:19:35 +0100 |
commit | 36f8822c9b06a23b804ce8dcffa5726c7d14fb2f (patch) | |
tree | 93ea4ec1c05e30bb95e56315de2826a10d6d7398 /shared/n-dhcp4 | |
parent | f860e929c04ef27ffb16eb7fb5456123a8595d2c (diff) | |
download | NetworkManager-36f8822c9b06a23b804ce8dcffa5726c7d14fb2f.tar.gz |
n-dhcp4: handle invalid return codes gracefully
Instead of terminating the program when the dispatch function returns
an invalid return code, log an error message and convert the error
code to a valid, generic one.
https://bugs.archlinux.org/task/64880
Diffstat (limited to 'shared/n-dhcp4')
-rw-r--r-- | shared/n-dhcp4/src/n-dhcp4-client.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/shared/n-dhcp4/src/n-dhcp4-client.c b/shared/n-dhcp4/src/n-dhcp4-client.c index 0bfe48ee95..4fa3d65daa 100644 --- a/shared/n-dhcp4/src/n-dhcp4-client.c +++ b/shared/n-dhcp4/src/n-dhcp4-client.c @@ -681,7 +681,12 @@ _c_public_ int n_dhcp4_client_dispatch(NDhcp4Client *client) { /* continue normally */ } else if (r) { - c_assert(r < _N_DHCP4_E_INTERNAL); + if (r >= _N_DHCP4_E_INTERNAL) { + n_dhcp4_c_log(client->config, LOG_ERR, + "invalid internal error code %d after dispatch", + r); + return N_DHCP4_E_INTERNAL; + } return r; } } |