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

Samuel Pitoiset samuel.pitoiset at gmail.com
Fri Oct 5 07:27:19 UTC 2018


Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>

On 10/5/18 2:37 AM, Dave Airlie wrote:
> 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);
> 


More information about the mesa-dev mailing list