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

Gustaw Smolarczyk wielkiegie at gmail.com
Fri Oct 5 12:05:54 UTC 2018


pt., 5 paź 2018 o 13:10 Grazvydas Ignotas <notasas at gmail.com> napisał(a):
>
> 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) ?

Won't EEXIST be returned even in case the path already exists but is
not a directory? [1]

Regards,
Gustaw Smolarczyk

[1] http://man7.org/linux/man-pages/man2/mkdir.2.html

>
> > +          return false;
> >
> >         ret = snprintf(path, PATH_MAX + 1, "%s%s%zd",
> >                        pwd.pw_dir, suffix2, sizeof(void *) * 8);
> > --
> > 2.17.1
>
> Gražvydas
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list