[CRIU] [PATCH 17/18] mount: print errors of chmod

Andrei Vagin avagin at openvz.org
Thu Nov 9 22:21:11 MSK 2017


From: Andrei Vagin <avagin at virtuozzo.com>

CID 175311 (#1 of 1): Unchecked return value from library (CHECKED_RETURN)
5. check_return: Calling chmod(mnt_roots, 511U) without checking return value. This library function may fail and return an error code.

Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
---
 criu/mount.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/criu/mount.c b/criu/mount.c
index ccd3fef2c..84d87dd0f 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -2487,7 +2487,8 @@ static int create_mnt_roots(void)
 		mnt_roots = NULL;
 		goto out;
 	}
-	chmod(mnt_roots, 0777);
+	if (chmod(mnt_roots, 0777))
+		pr_perror("Unable to change permissions of %s", mnt_roots);
 
 	exit_code = 0;
 out:
-- 
2.13.6



More information about the CRIU mailing list