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

Grazvydas Ignotas notasas at gmail.com
Fri Oct 5 11:10:23 UTC 2018


On Fri, Oct 5, 2018 at 3:38 AM Dave Airlie <airlied at gmail.com> 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)

if (ret == -1 && errno != EEXIST) ?

> +          return false;
>
>         ret = snprintf(path, PATH_MAX + 1, "%s%s%zd",
>                        pwd.pw_dir, suffix2, sizeof(void *) * 8);
> --
> 2.17.1

GraÅžvydas


More information about the mesa-dev mailing list