From 7fef2830446e1f98a02f8d8a3bba866b7edd5bd0 Mon Sep 17 00:00:00 2001 From: johalun Date: Mon, 5 Jun 2017 13:44:29 +0200 Subject: [PATCH] FreeBSD fixes Increase _POSIX_SOURCE value where needed. Increase _XOPEN_SOURCE value where needed. Conditionally link to libcap (only on Linux). Possibly some trailing whitespace fixes (automatic). --- CMakeLists.txt | 5 ++++- common/log.c | 2 +- common/stringop.c | 2 +- common/util.c | 2 +- sway/border.c | 2 +- sway/commands.c | 2 +- sway/commands/assign.c | 3 +-- sway/commands/set.c | 2 +- sway/config.c | 4 ++-- sway/criteria.c | 2 +- sway/input.c | 4 ++-- sway/main.c | 3 +-- sway/security.c | 2 +- swaygrab/json.c | 2 +- swaygrab/main.c | 2 +- 15 files changed, 20 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ed45830..edf486ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,7 +66,10 @@ find_package(GdkPixbuf) find_package(PAM) find_package(LibInput REQUIRED) -find_package(Libcap REQUIRED) + +if (CMAKE_SYSTEM_NAME STREQUAL Linux) + find_package(Libcap REQUIRED) +endif (CMAKE_SYSTEM_NAME STREQUAL Linux) if (CMAKE_SYSTEM_NAME STREQUAL FreeBSD) find_package(EpollShim REQUIRED) diff --git a/common/log.c b/common/log.c index 61937495..af1bdc3f 100644 --- a/common/log.c +++ b/common/log.c @@ -1,4 +1,4 @@ -#define _POSIX_C_SOURCE 1 +#define _POSIX_C_SOURCE 199506L #include #include #include diff --git a/common/stringop.c b/common/stringop.c index 99e9636d..4a37543d 100644 --- a/common/stringop.c +++ b/common/stringop.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#define _XOPEN_SOURCE 700 #include #include #include diff --git a/common/util.c b/common/util.c index 34bb5ec1..d6369853 100644 --- a/common/util.c +++ b/common/util.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#define _XOPEN_SOURCE 700 #include #include #include diff --git a/sway/border.c b/sway/border.c index 10ad92c2..df0022ce 100644 --- a/sway/border.c +++ b/sway/border.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#define _XOPEN_SOURCE 700 #include #include #include diff --git a/sway/commands.c b/sway/commands.c index 509fd1a8..34218491 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#define _XOPEN_SOURCE 700 #include #include #include diff --git a/sway/commands/assign.c b/sway/commands/assign.c index ec262bb8..c3b03bbc 100644 --- a/sway/commands/assign.c +++ b/sway/commands/assign.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#define _XOPEN_SOURCE 700 #include #include #include "sway/commands.h" @@ -55,4 +55,3 @@ struct cmd_results *cmd_assign(int argc, char **argv) { } return error ? error : cmd_results_new(CMD_SUCCESS, NULL, NULL); } - diff --git a/sway/commands/set.c b/sway/commands/set.c index 1d6bce04..e3d08dd3 100644 --- a/sway/commands/set.c +++ b/sway/commands/set.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#define _XOPEN_SOURCE 700 #include #include #include diff --git a/sway/config.c b/sway/config.c index 19b1882f..85823953 100644 --- a/sway/config.c +++ b/sway/config.c @@ -1,5 +1,5 @@ #define _POSIX_C_SOURCE 200809L -#define _XOPEN_SOURCE 500 +#define _XOPEN_SOURCE 700 #include #include #include @@ -527,7 +527,7 @@ bool load_main_config(const char *file, bool is_active) { list_add(config->config_chain, path); config->reading = true; - + // Read security configs bool success = true; DIR *dir = opendir(SYSCONFDIR "/sway/security.d"); diff --git a/sway/criteria.c b/sway/criteria.c index 1ea8311e..04683f66 100644 --- a/sway/criteria.c +++ b/sway/criteria.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#define _XOPEN_SOURCE 700 #include #include #include diff --git a/sway/input.c b/sway/input.c index 4f1ef760..6263f79f 100644 --- a/sway/input.c +++ b/sway/input.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#define _XOPEN_SOURCE 700 #include #include #include @@ -60,7 +60,7 @@ char *libinput_dev_unique_id(struct libinput_device *device) { } const char *fmt = "%d:%d:%s"; - snprintf(identifier, len, fmt, vendor, product, name); + snprintf(identifier, len, fmt, vendor, product, name); free(name); return identifier; } diff --git a/sway/main.c b/sway/main.c index 819788b1..82375e0b 100644 --- a/sway/main.c +++ b/sway/main.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#define _XOPEN_SOURCE 700 #define _POSIX_C_SOURCE 200112L #include #include @@ -433,4 +433,3 @@ int main(int argc, char **argv) { return exit_value; } - diff --git a/sway/security.c b/sway/security.c index 8eab6126..92de06c1 100644 --- a/sway/security.c +++ b/sway/security.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#define _XOPEN_SOURCE 700 #include #include #include diff --git a/swaygrab/json.c b/swaygrab/json.c index 563b8ba3..80dae299 100644 --- a/swaygrab/json.c +++ b/swaygrab/json.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#define _XOPEN_SOURCE 700 #include #include #include diff --git a/swaygrab/main.c b/swaygrab/main.c index f901d318..413de1fa 100644 --- a/swaygrab/main.c +++ b/swaygrab/main.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#define _XOPEN_SOURCE 700 #define _POSIX_C_SOURCE 199309L #include #include