[PATCH wayland 4/4] cursor: use wl_get_runtime_dir()

Emilio Pozuelo Monfort pochu27 at gmail.com
Mon Mar 11 09:10:57 PDT 2013


https://bugs.freedesktop.org/show_bug.cgi?id=62092
---
 cursor/Makefile.am        |    3 ++-
 cursor/os-compatibility.c |   14 ++++++++------
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/cursor/Makefile.am b/cursor/Makefile.am
index 61029b5..9519625 100644
--- a/cursor/Makefile.am
+++ b/cursor/Makefile.am
@@ -9,7 +9,8 @@ libwayland_cursor_la_SOURCES =			\
 	cursor-data.h				\
 	xcursor.c				\
 	xcursor.h
-libwayland_cursor_la_LIBADD = $(top_builddir)/src/libwayland-client.la
+libwayland_cursor_la_LIBADD = $(top_builddir)/src/libwayland-client.la \
+	$(top_builddir)/src/libwayland-util.la
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = wayland-cursor.pc
diff --git a/cursor/os-compatibility.c b/cursor/os-compatibility.c
index 418b0d3..1ec8a33 100644
--- a/cursor/os-compatibility.c
+++ b/cursor/os-compatibility.c
@@ -30,6 +30,7 @@
 #include <stdlib.h>
 
 #include "config.h"
+#include "wayland-private.h"
 #include "os-compatibility.h"
 
 #ifndef HAVE_MKOSTEMP
@@ -95,21 +96,22 @@ int
 os_create_anonymous_file(off_t size)
 {
 	static const char template[] = "/weston-shared-XXXXXX";
-	const char *path;
+	char *path;
 	char *name;
 	int fd;
 
-	path = getenv("XDG_RUNTIME_DIR");
-	if (!path) {
-		errno = ENOENT;
+	path = wl_get_runtime_dir();
+	if (!path)
 		return -1;
-	}
 
 	name = malloc(strlen(path) + sizeof(template));
-	if (!name)
+	if (!name) {
+		free(path);
 		return -1;
+	}
 
 	strcpy(name, path);
+	free(path);
 	strcat(name, template);
 
 	fd = create_tmpfile_cloexec(name);
-- 
1.7.10.4



More information about the wayland-devel mailing list