0
0
mirror of https://github.com/termux/termux-packages.git synced 2025-01-31 21:22:27 +00:00
termux-packages/packages/libwayland/xdg-runtime-dir.patch
2023-03-01 08:11:40 +08:00

54 lines
1.5 KiB
Diff

--- a/cursor/os-compatibility.c
+++ b/cursor/os-compatibility.c
@@ -138,8 +138,12 @@ os_create_anonymous_file(off_t size)
{
path = getenv("XDG_RUNTIME_DIR");
if (!path || path[0] != '/') {
+#ifndef __ANDROID__
errno = ENOENT;
return -1;
+#else
+ path = "@TERMUX_PREFIX@/tmp";
+#endif
}
name_size = strlen(path) + sizeof(template);
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -1077,11 +1077,15 @@ connect_to_socket(const char *name)
runtime_dir = getenv("XDG_RUNTIME_DIR");
if (((!runtime_dir || runtime_dir[0] != '/') && !path_is_absolute)) {
+#ifndef __ANDROID__
wl_log("error: XDG_RUNTIME_DIR is invalid or not set in the environment.\n");
/* to prevent programs reporting
* "failed to create display: Success" */
errno = ENOENT;
return -1;
+#else
+ runtime_dir = "@TERMUX_PREFIX@/tmp";
+#endif
}
fd = wl_os_socket_cloexec(PF_LOCAL, SOCK_STREAM, 0);
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -1567,6 +1567,7 @@ wl_socket_init_for_display_name(struct w
if (name[0] != '/') {
runtime_dir = getenv("XDG_RUNTIME_DIR");
if (!runtime_dir || runtime_dir[0] != '/') {
+#ifndef __ANDROID__
wl_log("error: XDG_RUNTIME_DIR is invalid or not set in"
" the environment\n");
@@ -1574,6 +1575,9 @@ wl_socket_init_for_display_name(struct w
* "failed to add socket: Success" */
errno = ENOENT;
return -1;
+#else
+ runtime_dir = "@TERMUX_PREFIX@/tmp";
+#endif
}
separator = "/";
}