[CRIU] [PATCH 3/5] action-scripts: Check for get_service_fd in run_scripts

Cyrill Gorcunov gorcunov at gmail.com
Wed May 16 11:36:35 MSK 2018


*** CID 190173:  Integer handling issues  (NEGATIVE_RETURNS)
/criu/action-scripts.c: 131 in run_scripts()

Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
 criu/action-scripts.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/criu/action-scripts.c b/criu/action-scripts.c
index 53ec3e558884..d0ef9a230a23 100644
--- a/criu/action-scripts.c
+++ b/criu/action-scripts.c
@@ -132,7 +132,12 @@ int run_scripts(enum script_actions act)
 
 		pr_debug("\tRPC\n");
 		rpc_sk = get_service_fd(RPC_SK_OFF);
-		ret = send_criu_rpc_script(act, (char *)action, rpc_sk, -1);
+		if (rpc_sk >= 0)
+			ret = send_criu_rpc_script(act, (char *)action, rpc_sk, -1);
+		else {
+			pr_err("Can't obtain RPC_SK_OFF service descriptor\n");
+			ret = -1;
+		}
 		goto out;
 	}
 
-- 
2.14.3



More information about the CRIU mailing list