mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-01 22:58:40 -04:00
client: require XDG_RUNTIME_DIR
An arbitrary fallback to the current directory is only confusing. Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
This commit is contained in:
parent
aa792ad3d6
commit
0c7ca38c7f
1 changed files with 11 additions and 8 deletions
|
|
@ -308,16 +308,15 @@ connect_to_socket(struct wl_display *display, const char *name)
|
||||||
const char *runtime_dir;
|
const char *runtime_dir;
|
||||||
size_t name_size;
|
size_t name_size;
|
||||||
|
|
||||||
display->fd = wl_os_socket_cloexec(PF_LOCAL, SOCK_STREAM, 0);
|
|
||||||
if (display->fd < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
runtime_dir = getenv("XDG_RUNTIME_DIR");
|
runtime_dir = getenv("XDG_RUNTIME_DIR");
|
||||||
if (runtime_dir == NULL) {
|
if (!runtime_dir) {
|
||||||
runtime_dir = ".";
|
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"XDG_RUNTIME_DIR not set, falling back to %s\n",
|
"error: XDG_RUNTIME_DIR not set in the environment.\n");
|
||||||
runtime_dir);
|
|
||||||
|
/* to prevent programs reporting
|
||||||
|
* "failed to create display: Success" */
|
||||||
|
errno = ENOENT;
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
|
|
@ -325,6 +324,10 @@ connect_to_socket(struct wl_display *display, const char *name)
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
name = "wayland-0";
|
name = "wayland-0";
|
||||||
|
|
||||||
|
display->fd = wl_os_socket_cloexec(PF_LOCAL, SOCK_STREAM, 0);
|
||||||
|
if (display->fd < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
memset(&addr, 0, sizeof addr);
|
memset(&addr, 0, sizeof addr);
|
||||||
addr.sun_family = AF_LOCAL;
|
addr.sun_family = AF_LOCAL;
|
||||||
name_size =
|
name_size =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue