----------------------------------------------------------------
*** CID 181218:  Error handling issues  (NEGATIVE_RETURNS)
/criu/kerndat.c: 692 in kerndat_has_ns_get_parent()
686                     return -1;
687             }
688
689             p_ns = ioctl(ns, NS_GET_PARENT);
690             if (p_ns >= 0 || errno == EPERM) {
691                     kdat.has_ns_get_parent = true;
>>>     CID 181218:  Error handling issues  (NEGATIVE_RETURNS)
>>>     "p_ns" is passed to a parameter that cannot be negative.
692                     close(p_ns);
693             }
694
695             close(ns);
696             return 0;
697     }
----------------------------------------------------------------

Signed-off-by: Kirill Tkhai <[email protected]>
---
 criu/kerndat.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/criu/kerndat.c b/criu/kerndat.c
index 5bca4bfc9..6a3a4de3f 100644
--- a/criu/kerndat.c
+++ b/criu/kerndat.c
@@ -689,7 +689,7 @@ int kerndat_has_ns_get_parent(void)
        p_ns = ioctl(ns, NS_GET_PARENT);
        if (p_ns >= 0 || errno == EPERM) {
                kdat.has_ns_get_parent = true;
-               close(p_ns);
+               close_safe(&p_ns);
        }
 
        close(ns);

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to