[Mesa-dev] [PATCH 1/4] egl/dri2: don't use the template keyword

Brian Paul brianp at vmware.com
Fri Sep 29 21:39:05 UTC 2017


For the series, Reviewed-by: Brian Paul <brianp at vmware.com>

On 09/29/2017 03:27 PM, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> for C++ editors
> ---
>   src/egl/drivers/dri2/platform_wayland.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
> index dc6fcc1..ae33477 100644
> --- a/src/egl/drivers/dri2/platform_wayland.c
> +++ b/src/egl/drivers/dri2/platform_wayland.c
> @@ -1444,38 +1444,38 @@ create_tmpfile_cloexec(char *tmpname)
>    *
>    * If the C library implements posix_fallocate(), it is used to
>    * guarantee that disk space is available for the file at the
>    * given size. If disk space is insufficent, errno is set to ENOSPC.
>    * If posix_fallocate() is not supported, program may receive
>    * SIGBUS on accessing mmap()'ed file contents instead.
>    */
>   static int
>   os_create_anonymous_file(off_t size)
>   {
> -   static const char template[] = "/mesa-shared-XXXXXX";
> +   static const char templ[] = "/mesa-shared-XXXXXX";
>      const char *path;
>      char *name;
>      int fd;
>      int ret;
>
>      path = getenv("XDG_RUNTIME_DIR");
>      if (!path) {
>         errno = ENOENT;
>         return -1;
>      }
>
> -   name = malloc(strlen(path) + sizeof(template));
> +   name = malloc(strlen(path) + sizeof(templ));
>      if (!name)
>         return -1;
>
>      strcpy(name, path);
> -   strcat(name, template);
> +   strcat(name, templ);
>
>      fd = create_tmpfile_cloexec(name);
>
>      free(name);
>
>      if (fd < 0)
>         return -1;
>
>      ret = ftruncate(fd, size);
>      if (ret < 0) {
>



More information about the mesa-dev mailing list