[Mesa-dev] [PATCH] radv: check return from mkdir

Dave Airlie airlied at gmail.com
Fri Oct 5 00:37:49 UTC 2018


From: Dave Airlie <airlied at redhat.com>

There may be some security or sandbox reason this might fail, so
check and fail appropriately.
---
 src/amd/vulkan/radv_meta.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/amd/vulkan/radv_meta.c b/src/amd/vulkan/radv_meta.c
index 1ec8896afa2..6616b1da65a 100644
--- a/src/amd/vulkan/radv_meta.c
+++ b/src/amd/vulkan/radv_meta.c
@@ -248,7 +248,9 @@ radv_builtin_cache_path(char *path)
 
 	strcpy(path, pwd.pw_dir);
 	strcat(path, "/.cache");
-	mkdir(path, 0755);
+	ret = mkdir(path, 0755);
+	if (ret == -1)
+	   return false;
 
 	ret = snprintf(path, PATH_MAX + 1, "%s%s%zd",
 		       pwd.pw_dir, suffix2, sizeof(void *) * 8);
-- 
2.17.1



More information about the mesa-dev mailing list