Some of the error handling was checking for != 0 on functions which returned
positive values on success.

Someone should have a look at the last one. I'm not sure what it was
supposed to do, since it failed every single time.

Signed-off-by: Alan Ott <a...@signal11.us>
---
 src/coordinator.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/coordinator.c b/src/coordinator.c
index a09633a..fe7d092 100644
--- a/src/coordinator.c
+++ b/src/coordinator.c
@@ -94,7 +94,8 @@ static int mlme_start(uint16_t short_addr, uint16_t pan, 
uint8_t channel, uint8_
        nla_put_u8(msg, IEEE802154_ATTR_COORD_REALIGN, 0);
 #endif
        int err = nl_send_auto_complete(nl, msg);
-       log_msg_nl_perror("nl_send_auto_complete", err);
+       if (err < 0)
+               log_msg_nl_perror("nl_send_auto_complete", err);
        return 0;
 }
 
@@ -129,7 +130,8 @@ static int coordinator_associate(struct genlmsghdr *ghdr, 
struct nlattr **attrs)
 
        int err = nl_send_auto_complete(nl, msg);
 
-       log_msg_nl_perror("nl_send_auto_complete", err);
+       if (err < 0)
+               log_msg_nl_perror("nl_send_auto_complete", err);
 
        return 0;
 }
@@ -408,7 +410,7 @@ int main(int argc, char **argv)
        log_msg_nl_perror("genl_connect", err);
 
        family = genl_ctrl_resolve(nl, IEEE802154_NL_NAME);
-       log_msg_nl_perror("genl_ctrl_resolve", NLE_NOMEM);
+       //log_msg_nl_perror("genl_ctrl_resolve", NLE_NOMEM);
 
        nl_socket_add_membership(nl, nl_get_multicast_id(nl, 
IEEE802154_NL_NAME, IEEE802154_MCAST_COORD_NAME));
 
-- 
1.7.0.4


------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel

Reply via email to