Skip to content

Commit

Permalink
test/interactive-wayland: avoid unused function warning due to config…
Browse files Browse the repository at this point in the history
…uration

test/interactive-wayland.c:95:1: warning: ‘set_cloexec_or_close’ defined but not used [-Wunused-function]

Signed-off-by: Ran Benita <[email protected]>
  • Loading branch information
bluetech committed Aug 16, 2017
1 parent 7634875 commit 14686cd
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions test/interactive-wayland.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 14686cd

Please sign in to comment.