Merge pull request #2542 from sghctoma/fix-freebsd-build

FreeBSD fixes
This commit is contained in:
Drew DeVault 2018-09-03 10:59:18 -04:00 committed by GitHub
commit e4afd33d47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 35 additions and 14 deletions

View file

@ -1,4 +1,4 @@
#define _XOPEN_SOURCE 500 #define _POSIX_C_SOURCE 200809
#include <assert.h> #include <assert.h>
#include <cairo/cairo.h> #include <cairo/cairo.h>
#include <fcntl.h> #include <fcntl.h>

View file

@ -38,7 +38,7 @@ pango = dependency('pango')
pangocairo = dependency('pangocairo') pangocairo = dependency('pangocairo')
gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: false) gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: false)
pixman = dependency('pixman-1') pixman = dependency('pixman-1')
libcap = dependency('libcap') libcap = dependency('libcap', required: false)
libinput = dependency('libinput', version: '>=1.6.0') libinput = dependency('libinput', version: '>=1.6.0')
libpam = cc.find_library('pam') libpam = cc.find_library('pam')
systemd = dependency('libsystemd', required: false) systemd = dependency('libsystemd', required: false)
@ -104,7 +104,7 @@ if scdoc.found()
endforeach endforeach
endif endif
add_project_arguments('-DSYSCONFDIR="/@0@"'.format(sysconfdir), language : 'c') add_project_arguments('-DSYSCONFDIR="/@0@/@1@"'.format(prefix, sysconfdir), language : 'c')
version = get_option('sway-version') version = get_option('sway-version')
if version != '' if version != ''

View file

@ -1,4 +1,4 @@
#define _XOPEN_SOURCE 500 #define _POSIX_C_SOURCE 200809
#include <ctype.h> #include <ctype.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>

View file

@ -1,4 +1,4 @@
#define _XOPEN_SOURCE 500 #define _POSIX_C_SOURCE 200809
#include <string.h> #include <string.h>
#include <strings.h> #include <strings.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>

View file

@ -1,4 +1,4 @@
#define _XOPEN_SOURCE 500 #define _POSIX_C_SOURCE 200809
#include <libgen.h> #include <libgen.h>
#include <strings.h> #include <strings.h>
#include <unistd.h> #include <unistd.h>

View file

@ -366,13 +366,15 @@ int main(int argc, char **argv) {
return 1; return 1;
} }
#ifdef __linux__ #if defined(__linux__) || defined(__FreeBSD__)
if (getuid() != geteuid() || getgid() != getegid()) { if (getuid() != geteuid() || getgid() != getegid()) {
#ifdef __linux__
// Retain capabilities after setuid() // Retain capabilities after setuid()
if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0)) { if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0)) {
wlr_log(WLR_ERROR, "Cannot keep caps after setuid()"); wlr_log(WLR_ERROR, "Cannot keep caps after setuid()");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
#endif
suid = true; suid = true;
} }
#endif #endif
@ -382,7 +384,7 @@ int main(int argc, char **argv) {
detect_proprietary(); detect_proprietary();
detect_raspi(); detect_raspi();
#ifdef __linux__ #if defined(__linux__) || defined(__FreeBSD__)
drop_permissions(suid); drop_permissions(suid);
#endif #endif
// handle SIGTERM signals // handle SIGTERM signals

View file

@ -140,6 +140,10 @@ bool server_init(struct sway_server *server) {
void server_fini(struct sway_server *server) { void server_fini(struct sway_server *server) {
// TODO: free sway-specific resources // TODO: free sway-specific resources
#ifdef HAVE_XWAYLAND
wlr_xwayland_destroy(server->xwayland.wlr_xwayland);
#endif
wl_display_destroy_clients(server->wl_display);
wl_display_destroy(server->wl_display); wl_display_destroy(server->wl_display);
list_free(server->dirty_containers); list_free(server->dirty_containers);
list_free(server->transactions); list_free(server->transactions);

View file

@ -1,4 +1,4 @@
#define _XOPEN_SOURCE 500 #define _POSIX_C_SOURCE 200809
#include <ctype.h> #include <ctype.h>
#include <limits.h> #include <limits.h>
#include <stdbool.h> #include <stdbool.h>

View file

@ -1,4 +1,4 @@
#define _XOPEN_SOURCE 500 #define _POSIX_C_SOURCE 200809
#include <limits.h> #include <limits.h>
#include <string.h> #include <string.h>
#include <strings.h> #include <strings.h>

View file

@ -24,7 +24,16 @@ executable(
install: true install: true
) )
install_data( if is_freebsd
'pam/swaylock', install_data(
install_dir: sysconfdir + '/pam.d/' 'pam/swaylock.freebsd',
) install_dir: sysconfdir + '/pam.d/',
rename: 'swaylock'
)
else
install_data(
'pam/swaylock.linux',
install_dir: sysconfdir + '/pam.d/',
rename: 'swaylock'
)
endif

View file

@ -0,0 +1,6 @@
#
# PAM configuration file for the swaylock screen locker. By default, it includes
# the 'passwd' configuration file (see /etc/pam.d/passwd)
#
auth include passwd