On Sun Nov 07, 2021 at 07:07:09AM +0100, Sebastien Marie wrote:
> Hi,
>
> While looking at wayland/wayland (thanks rsadowski), I saw a warning
> while compiling which trigger me.
>
> clang complained about wrong indent for a statement after if().
>
> ../wayland-1.19.0/src/wayland-server.c:627:3: warning: misleading
> indentation; statement is not part of the previous 'if'
> [-Wmisleading-indentation]
> *gid = client->xucred.cr_gid;
> ^
> ../wayland-1.19.0/src/wayland-server.c:624:2: note: previous statement is here
> if (pid)
> ^
> 2 warnings generated.
>
>
> After looking at code, it seems to me that a patch for OpenBSD is
> wrong, but I am not completely sure about the right correction.
>
> Below a proposed diff, which set pid to 0 if not NULL.
>
> Comments or OK ?
That's on me, of course. Thanks Sebastien, this fixes the "event-loop-test"
test.
OK rsadowski@
> --
> Sebastien Marie
>
> diff c27e118ac4efa87704c8056c0603a4b05eaf242f
> /home/semarie/repos/openbsd/ports
> blob - bcb82a4cb9cdb06771e4f80f64cff236ff1d519b
> file + wayland/wayland/Makefile
> --- wayland/wayland/Makefile
> +++ wayland/wayland/Makefile
> @@ -3,6 +3,7 @@
> COMMENT = Display server protocol
>
> DISTNAME = wayland-1.19.0
> +REVISION = 0
>
> CATEGORIES = wayland
>
> blob - 38d924c113f3e520b7cc1c691f348312e106f9a5
> file + wayland/wayland/patches/patch-src_wayland-server_c
> --- wayland/wayland/patches/patch-src_wayland-server_c
> +++ wayland/wayland/patches/patch-src_wayland-server_c
> @@ -77,19 +77,14 @@ Index: src/wayland-server.c
>
> client->connection = wl_connection_create(fd);
> if (client->connection == NULL)
> -@@ -586,12 +619,28 @@ WL_EXPORT void
> +@@ -586,12 +619,23 @@ WL_EXPORT void
> wl_client_get_credentials(struct wl_client *client,
> pid_t *pid, uid_t *uid, gid_t *gid)
> {
> +#ifdef HAVE_SYS_UCRED_H
> + /* DragonFly or OpenBSD */
> if (pid)
> -+#if defined(__OpenBSD__)
> -+ *uid = client->xucred.cr_uid;
> -+ *gid = client->xucred.cr_gid;
> -+#else
> + *pid = 0;
> -+#endif
> + if (uid)
> + *uid = client->xucred.cr_uid;
> + if (gid)
>