When socket() fails, it returns -1 instead of file descriptor and we might pass
this -1 to close() in close_and_exit label -> unexpected result.

Signed-off-by: Jan Safranek <jsafr...@redhat.com>
---

 src/daemon/cgrulesengd.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/daemon/cgrulesengd.c b/src/daemon/cgrulesengd.c
index 2f42a57..ff72965 100644
--- a/src/daemon/cgrulesengd.c
+++ b/src/daemon/cgrulesengd.c
@@ -722,9 +722,9 @@ static int cgre_create_netlink_socket_process_msg(void)
        }
 
 close_and_exit:
-       if (sk_nl)
+       if (sk_nl > 0)
                close(sk_nl);
-       if (sk_unix)
+       if (sk_unix > 0)
                close(sk_unix);
        return rc;
 }


------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. 
http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to