mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-29 05:40:16 -04:00
Check that XDG base directories paths are absolute
The [spec][1] reads: > All paths set in these environment variables must be absolute. If an > implementation encounters a relative path in any of these variables it should > consider the path invalid and ignore it. and > If $XDG_DATA_HOME is either not set or empty, a default equal to > $HOME/.local/share should be used. Testing that the path is absolute also entails that is is non-empty. [1]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html Signed-off-by: Antonin Décimo <antonin.decimo@gmail.com>
This commit is contained in:
parent
f710d01663
commit
9434e8d69f
8 changed files with 13 additions and 12 deletions
|
|
@ -1557,8 +1557,9 @@ wl_socket_init_for_display_name(struct wl_socket *s, const char *name)
|
|||
|
||||
if (name[0] != '/') {
|
||||
runtime_dir = getenv("XDG_RUNTIME_DIR");
|
||||
if (!runtime_dir) {
|
||||
wl_log("error: XDG_RUNTIME_DIR not set in the environment\n");
|
||||
if (!runtime_dir || runtime_dir[0] != '/') {
|
||||
wl_log("error: XDG_RUNTIME_DIR is invalid or not set in"
|
||||
" the environment\n");
|
||||
|
||||
/* to prevent programs reporting
|
||||
* "failed to add socket: Success" */
|
||||
|
|
@ -1718,7 +1719,7 @@ wl_display_add_socket_fd(struct wl_display *display, int sock_fd)
|
|||
*
|
||||
* If the socket name is a relative path, the Unix socket will be created in
|
||||
* the directory pointed to by environment variable XDG_RUNTIME_DIR. If
|
||||
* XDG_RUNTIME_DIR is not set, then this function fails and returns -1.
|
||||
* XDG_RUNTIME_DIR is invalid or not set, then this function fails and returns -1.
|
||||
*
|
||||
* If the socket name is an absolute path, then it is used as-is for the
|
||||
* the Unix socket.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue