summaryrefslogtreecommitdiff
path: root/client/pool-buffer.c
diff options
context:
space:
mode:
authorFurkan Sahin <furkan-dev@proton.me>2019-10-28 22:54:16 -0700
committerFurkan Sahin <furkan-dev@proton.me>2019-10-28 22:54:16 -0700
commit966348c4da9f720a8ea40d5e31a8aca8b501efa3 (patch)
tree2d707d7d6c85453fdc187ecd5e8c8cda34493300 /client/pool-buffer.c
parent38fe1ee730d5dc2a054495d9f470f04df5b44bc7 (diff)
Rename symbol set_cloexec to sway_set_cloexec, remove duplicates.
set_cloexec is defined by both sway and wlroots (and who-knows-else), so rename the sway one for supporting static linkage. We also remove the duplicate version of this in client/. Fixes: https://github.com/swaywm/sway/issues/4677
Diffstat (limited to 'client/pool-buffer.c')
-rw-r--r--client/pool-buffer.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/client/pool-buffer.c b/client/pool-buffer.c
index 836c6b13..fd500c49 100644
--- a/client/pool-buffer.c
+++ b/client/pool-buffer.c
@@ -11,19 +11,7 @@
#include <wayland-client.h>
#include "config.h"
#include "pool-buffer.h"
-
-static bool set_cloexec(int fd) {
- long flags = fcntl(fd, F_GETFD);
- if (flags == -1) {
- return false;
- }
-
- if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == -1) {
- return false;
- }
-
- return true;
-}
+#include "util.h"
static int create_pool_file(size_t size, char **name) {
static const char template[] = "sway-client-XXXXXX";
@@ -46,7 +34,7 @@ static int create_pool_file(size_t size, char **name) {
return -1;
}
- if (!set_cloexec(fd)) {
+ if (!sway_set_cloexec(fd, true)) {
close(fd);
return -1;
}