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; } ------------------------------------------------------------------------------ EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev _______________________________________________ Libcg-devel mailing list Libcg-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libcg-devel