[Olsr-dev] [PATCH v1 07/23] linux: call olsr_exit() instead of exit()
Ferry Huberts
(spam-protected)
Fri Nov 6 16:28:59 CET 2015
From: Ferry Huberts <(spam-protected)>
olsr_exit tries to do proper shutdown that cleans up data structures
by raise()ing the SIGTERM signal. This signal then causes olsr_shutdown
to be invoked (only when the signal handler is setup), which will do
the cleanup of the data structures.
According to the man page of raise():
If the signal causes a handler to be called, raise() will return
only after the signal handler has returned.
And since olsr_exit() invokes exit() after raise()ing the signal, there
is no harm in calling it.
Signed-off-by: Ferry Huberts <(spam-protected)>
---
src/linux/nl80211_link_info.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/linux/nl80211_link_info.c b/src/linux/nl80211_link_info.c
index ddb7ab3..06953e9 100644
--- a/src/linux/nl80211_link_info.c
+++ b/src/linux/nl80211_link_info.c
@@ -253,8 +253,7 @@ static void nl80211_link_info_for_interface(struct interface_olsr *iface, struct
genlmsg_put(request_message, NL_AUTO_PID, NL_AUTO_SEQ, netlink_id, 0, NLM_F_DUMP, NL80211_CMD_GET_STATION, 0);
if (nla_put_u32(request_message, NL80211_ATTR_IFINDEX, iface->if_index) == -1) {
- olsr_syslog(OLSR_LOG_ERR, "Failed to add interface index to netlink message");
- exit(1);
+ olsr_exit("Failed to add interface index to netlink message", 1);
}
#ifdef NL_DEBUG
@@ -266,8 +265,7 @@ static void nl80211_link_info_for_interface(struct interface_olsr *iface, struct
}
if (nl_cb_set(request_cb, NL_CB_VALID, NL_CB_CUSTOM, parse_nl80211_message, &link_context) != 0) {
- olsr_syslog(OLSR_LOG_ERR, "Failed to set netlink message callback");
- exit(1);
+ olsr_exit("Failed to set netlink message callback", 1);
}
nl_cb_err(request_cb, NL_CB_CUSTOM, error_handler, &finish);
@@ -275,8 +273,7 @@ static void nl80211_link_info_for_interface(struct interface_olsr *iface, struct
nl_cb_set(request_cb, NL_CB_ACK, NL_CB_CUSTOM, ack_handler, &finish);
if (nl_send_auto_complete(gen_netlink_socket, request_message) < 0) {
- olsr_syslog(OLSR_LOG_ERR, "Failed sending the request message with netlink");
- exit(1);
+ olsr_exit("Failed sending the request message with netlink", 1);
}
while (! finish) {
--
2.5.0
More information about the Olsr-dev
mailing list