From 14686cd1a81a0172a9cd9eb23bbd3f0df3b10e05 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Wed, 16 Aug 2017 20:24:27 +0300 Subject: [PATCH] test/interactive-wayland: avoid unused function warning due to configuration MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit test/interactive-wayland.c:95:1: warning: ‘set_cloexec_or_close’ defined but not used [-Wunused-function] Signed-off-by: Ran Benita --- test/interactive-wayland.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/test/interactive-wayland.c b/test/interactive-wayland.c index 6fd57b8..95775b4 100644 --- a/test/interactive-wayland.c +++ b/test/interactive-wayland.c @@ -71,6 +71,16 @@ struct interactive_seat { static bool terminate; +#ifdef HAVE_MKOSTEMP +static int +create_tmpfile_cloexec(char *tmpname) +{ + int fd = mkostemp(tmpname, O_CLOEXEC); + if (fd >= 0) + unlink(tmpname); + return fd; +} +#else /* The following utility functions are taken from Weston's * shared/os-compatibility.c. */ static int @@ -104,22 +114,14 @@ set_cloexec_or_close(int fd) static int create_tmpfile_cloexec(char *tmpname) { - int fd; - -#ifdef HAVE_MKOSTEMP - fd = mkostemp(tmpname, O_CLOEXEC); - if (fd >= 0) - unlink(tmpname); -#else - fd = mkstemp(tmpname); + int fd = mkstemp(tmpname); if (fd >= 0) { fd = set_cloexec_or_close(fd); unlink(tmpname); } -#endif - return fd; } +#endif /* * Create a new, unique, anonymous file of the given size, and -- 2.7.4