Failing to add socket to wayland display.

Ryo Munakata ryomnktml at gmail.com
Fri Oct 10 07:38:38 PDT 2014


On Fri, 10 Oct 2014 15:32:54 +0530
Srivardhan <sri.hebbar at samsung.com> wrote:

> Hi,
> 
> I wrote a small program to understand wayland-server. Below is the program:
> #include <stdio.h>
> #include <wayland-server.h>
> 
> const char socket_name[] = "test_socket";
> 
> int main()
> {
>         struct wl_display *test_display = NULL;
>         int stat = 0;
> 
>         test_display = wl_display_create();
>         if (test_display)
>                 fprintf(stderr, "Created wayland display successfully\n");
>         else
>                 fprintf(stderr, "Failed to created wayland display\n");
> 
>         stat = wl_display_add_socket(test_display, socket_name);
>         if (stat)
>                 fprintf(stderr, "Successfully connected to wayland
> display\n");
>         else
>                 fprintf(stderr, "Failed to connect to wayland display\n");
> 
>         return 0;
> }
> 
> When I run I get the below output:
> Created wayland display successfully
> Failed to connect to wayland display
> 
> Why is it failing to connect to wayland display?

wl_display_add_socket() returns 0 on success. Otherwise reuturns -1.
See: http://cgit.freedesktop.org/wayland/wayland/tree/src/wayland-server.c#n1185
So your call to wl_display_add_socket() seems to succeed.

Thanks.
-- 
Ryo Munakata <ryomnktml at gmail.com>


More information about the wayland-devel mailing list