mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-02 09:01:39 -05:00
server: 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
0c7ca38c7f
commit
c29020332a
1 changed files with 10 additions and 7 deletions
|
|
@ -1091,6 +1091,16 @@ wl_display_add_socket(struct wl_display *display, const char *name)
|
|||
socklen_t size, name_size;
|
||||
const char *runtime_dir;
|
||||
|
||||
runtime_dir = getenv("XDG_RUNTIME_DIR");
|
||||
if (!runtime_dir) {
|
||||
wl_log("error: XDG_RUNTIME_DIR not set in the environment\n");
|
||||
|
||||
/* to prevent programs reporting
|
||||
* "failed to add socket: Success" */
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
s = malloc(sizeof *s);
|
||||
if (s == NULL)
|
||||
return -1;
|
||||
|
|
@ -1101,13 +1111,6 @@ wl_display_add_socket(struct wl_display *display, const char *name)
|
|||
return -1;
|
||||
}
|
||||
|
||||
runtime_dir = getenv("XDG_RUNTIME_DIR");
|
||||
if (runtime_dir == NULL) {
|
||||
runtime_dir = ".";
|
||||
wl_log("XDG_RUNTIME_DIR not set, falling back to %s\n",
|
||||
runtime_dir);
|
||||
}
|
||||
|
||||
if (name == NULL)
|
||||
name = getenv("WAYLAND_DISPLAY");
|
||||
if (name == NULL)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue