[PATCH 2/2] cache_mngr: Fix assignment of error code in nl_cache_mngr_alloc()

Tobias Klauser tklauser at distanz.ch
Tue Jun 17 05:58:10 PDT 2014


In the current form, the parentheses in these two if (...) statements
lead to err being assigned the result of nl_connect(...) < 0 and
nl_socket_set_nonblocking(...) < 0 instead of the return value of these
functions. Adjust the parentheses to assign the returned error code to
err.

Signed-off-by: Tobias Klauser <tklauser at distanz.ch>
---
 lib/cache_mngr.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/cache_mngr.c b/lib/cache_mngr.c
index bec4bb0..c88f7c4 100644
--- a/lib/cache_mngr.c
+++ b/lib/cache_mngr.c
@@ -165,10 +165,10 @@ int nl_cache_mngr_alloc(struct nl_sock *sk, int protocol, int flags,
 	/* Required to receive async event notifications */
 	nl_socket_disable_seq_check(mngr->cm_sock);
 
-	if ((err = nl_connect(mngr->cm_sock, protocol) < 0))
+	if ((err = nl_connect(mngr->cm_sock, protocol)) < 0)
 		goto errout;
 
-	if ((err = nl_socket_set_nonblocking(mngr->cm_sock) < 0))
+	if ((err = nl_socket_set_nonblocking(mngr->cm_sock)) < 0)
 		goto errout;
 
 	/* Create and allocate socket for sync cache fills */
-- 
1.7.9.5





More information about the libnl mailing list