Commit 36f8822c authored by Beniamino Galvani's avatar Beniamino Galvani

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
parent f860e929
......@@ -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;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment