diff options
author | Sheena Artrip <sheena.artrip@gmail.com> | 2019-10-28 22:54:16 -0700 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-11-01 12:41:08 -0400 |
commit | 7efb5d467368ea9168cebc2473bc3c6942e031bb (patch) | |
tree | 2d707d7d6c85453fdc187ecd5e8c8cda34493300 /client/pool-buffer.c | |
parent | focus: add a NULL check in `focus <direction>` (diff) | |
download | sway-7efb5d467368ea9168cebc2473bc3c6942e031bb.tar.gz sway-7efb5d467368ea9168cebc2473bc3c6942e031bb.tar.zst sway-7efb5d467368ea9168cebc2473bc3c6942e031bb.zip |
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.c | 16 |
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 @@ | |||
11 | #include <wayland-client.h> | 11 | #include <wayland-client.h> |
12 | #include "config.h" | 12 | #include "config.h" |
13 | #include "pool-buffer.h" | 13 | #include "pool-buffer.h" |
14 | 14 | #include "util.h" | |
15 | static bool set_cloexec(int fd) { | ||
16 | long flags = fcntl(fd, F_GETFD); | ||
17 | if (flags == -1) { | ||
18 | return false; | ||
19 | } | ||
20 | |||
21 | if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == -1) { | ||
22 | return false; | ||
23 | } | ||
24 | |||
25 | return true; | ||
26 | } | ||
27 | 15 | ||
28 | static int create_pool_file(size_t size, char **name) { | 16 | static int create_pool_file(size_t size, char **name) { |
29 | static const char template[] = "sway-client-XXXXXX"; | 17 | static const char template[] = "sway-client-XXXXXX"; |
@@ -46,7 +34,7 @@ static int create_pool_file(size_t size, char **name) { | |||
46 | return -1; | 34 | return -1; |
47 | } | 35 | } |
48 | 36 | ||
49 | if (!set_cloexec(fd)) { | 37 | if (!sway_set_cloexec(fd, true)) { |
50 | close(fd); | 38 | close(fd); |
51 | return -1; | 39 | return -1; |
52 | } | 40 | } |