diff options
-rw-r--r-- | client/pool-buffer.c | 2 | ||||
-rw-r--r-- | common/ipc-client.c | 8 | ||||
-rw-r--r-- | meson.build | 4 | ||||
-rw-r--r-- | sway/commands.c | 2 | ||||
-rw-r--r-- | sway/commands/bar.c | 2 | ||||
-rw-r--r-- | sway/commands/output/background.c | 2 | ||||
-rw-r--r-- | sway/desktop/render.c | 3 | ||||
-rw-r--r-- | sway/ipc-server.c | 8 | ||||
-rw-r--r-- | sway/main.c | 6 | ||||
-rw-r--r-- | sway/server.c | 4 | ||||
-rw-r--r-- | sway/tree/workspace.c | 2 | ||||
-rw-r--r-- | swaybar/ipc.c | 2 | ||||
-rw-r--r-- | swaylock/meson.build | 17 | ||||
-rw-r--r-- | swaylock/pam/swaylock.freebsd | 6 | ||||
-rw-r--r-- | swaylock/pam/swaylock.linux (renamed from swaylock/pam/swaylock) | 0 |
15 files changed, 45 insertions, 23 deletions
diff --git a/client/pool-buffer.c b/client/pool-buffer.c index fa468c0d..588bd06c 100644 --- a/client/pool-buffer.c +++ b/client/pool-buffer.c | |||
@@ -1,4 +1,4 @@ | |||
1 | #define _XOPEN_SOURCE 500 | 1 | #define _POSIX_C_SOURCE 200809 |
2 | #include <assert.h> | 2 | #include <assert.h> |
3 | #include <cairo/cairo.h> | 3 | #include <cairo/cairo.h> |
4 | #include <fcntl.h> | 4 | #include <fcntl.h> |
diff --git a/common/ipc-client.c b/common/ipc-client.c index 24a2f9c2..496fd131 100644 --- a/common/ipc-client.c +++ b/common/ipc-client.c | |||
@@ -78,8 +78,8 @@ struct ipc_response *ipc_recv_response(int socketfd) { | |||
78 | } | 78 | } |
79 | 79 | ||
80 | total = 0; | 80 | total = 0; |
81 | response->size = data32[0]; | 81 | memcpy(&response->size, &data32[0], sizeof(data32[0])); |
82 | response->type = data32[1]; | 82 | memcpy(&response->type, &data32[1], sizeof(data32[1])); |
83 | char *payload = malloc(response->size + 1); | 83 | char *payload = malloc(response->size + 1); |
84 | if (!payload) { | 84 | if (!payload) { |
85 | goto error_2; | 85 | goto error_2; |
@@ -112,8 +112,8 @@ char *ipc_single_command(int socketfd, uint32_t type, const char *payload, uint3 | |||
112 | char data[ipc_header_size]; | 112 | char data[ipc_header_size]; |
113 | uint32_t *data32 = (uint32_t *)(data + sizeof(ipc_magic)); | 113 | uint32_t *data32 = (uint32_t *)(data + sizeof(ipc_magic)); |
114 | memcpy(data, ipc_magic, sizeof(ipc_magic)); | 114 | memcpy(data, ipc_magic, sizeof(ipc_magic)); |
115 | data32[0] = *len; | 115 | memcpy(&data32[0], len, sizeof(*len)); |
116 | data32[1] = type; | 116 | memcpy(&data32[1], &type, sizeof(type)); |
117 | 117 | ||
118 | if (write(socketfd, data, ipc_header_size) == -1) { | 118 | if (write(socketfd, data, ipc_header_size) == -1) { |
119 | sway_abort("Unable to send IPC header"); | 119 | sway_abort("Unable to send IPC header"); |
diff --git a/meson.build b/meson.build index eb5cba84..253a4e96 100644 --- a/meson.build +++ b/meson.build | |||
@@ -38,7 +38,7 @@ pango = dependency('pango') | |||
38 | pangocairo = dependency('pangocairo') | 38 | pangocairo = dependency('pangocairo') |
39 | gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: false) | 39 | gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: false) |
40 | pixman = dependency('pixman-1') | 40 | pixman = dependency('pixman-1') |
41 | libcap = dependency('libcap') | 41 | libcap = dependency('libcap', required: false) |
42 | libinput = dependency('libinput', version: '>=1.6.0') | 42 | libinput = dependency('libinput', version: '>=1.6.0') |
43 | libpam = cc.find_library('pam') | 43 | libpam = cc.find_library('pam') |
44 | systemd = dependency('libsystemd', required: false) | 44 | systemd = dependency('libsystemd', required: false) |
@@ -104,7 +104,7 @@ if scdoc.found() | |||
104 | endforeach | 104 | endforeach |
105 | endif | 105 | endif |
106 | 106 | ||
107 | add_project_arguments('-DSYSCONFDIR="/@0@"'.format(sysconfdir), language : 'c') | 107 | add_project_arguments('-DSYSCONFDIR="/@0@/@1@"'.format(prefix, sysconfdir), language : 'c') |
108 | 108 | ||
109 | version = get_option('sway-version') | 109 | version = get_option('sway-version') |
110 | if version != '' | 110 | if version != '' |
diff --git a/sway/commands.c b/sway/commands.c index 359856cc..e72b8916 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -1,4 +1,4 @@ | |||
1 | #define _XOPEN_SOURCE 500 | 1 | #define _POSIX_C_SOURCE 200809 |
2 | #include <ctype.h> | 2 | #include <ctype.h> |
3 | #include <stdarg.h> | 3 | #include <stdarg.h> |
4 | #include <stdlib.h> | 4 | #include <stdlib.h> |
diff --git a/sway/commands/bar.c b/sway/commands/bar.c index f6a70c17..f760888e 100644 --- a/sway/commands/bar.c +++ b/sway/commands/bar.c | |||
@@ -1,4 +1,4 @@ | |||
1 | #define _XOPEN_SOURCE 500 | 1 | #define _POSIX_C_SOURCE 200809 |
2 | #include <string.h> | 2 | #include <string.h> |
3 | #include <strings.h> | 3 | #include <strings.h> |
4 | #include <wlr/util/log.h> | 4 | #include <wlr/util/log.h> |
diff --git a/sway/commands/output/background.c b/sway/commands/output/background.c index 74894812..ddad679d 100644 --- a/sway/commands/output/background.c +++ b/sway/commands/output/background.c | |||
@@ -1,4 +1,4 @@ | |||
1 | #define _XOPEN_SOURCE 500 | 1 | #define _POSIX_C_SOURCE 200809 |
2 | #include <libgen.h> | 2 | #include <libgen.h> |
3 | #include <strings.h> | 3 | #include <strings.h> |
4 | #include <unistd.h> | 4 | #include <unistd.h> |
diff --git a/sway/desktop/render.c b/sway/desktop/render.c index 5556e5b3..695213eb 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c | |||
@@ -346,7 +346,8 @@ static void render_titlebar(struct sway_output *output, | |||
346 | float output_scale = output->wlr_output->scale; | 346 | float output_scale = output->wlr_output->scale; |
347 | enum sway_container_layout layout = state->parent->current.layout; | 347 | enum sway_container_layout layout = state->parent->current.layout; |
348 | list_t *children = state->parent->current.children; | 348 | list_t *children = state->parent->current.children; |
349 | bool is_last_child = children->items[children->length - 1] == con; | 349 | bool is_last_child = children->length == 0 || |
350 | children->items[children->length - 1] == con; | ||
350 | double output_x = output->swayc->current.swayc_x; | 351 | double output_x = output->swayc->current.swayc_x; |
351 | double output_y = output->swayc->current.swayc_y; | 352 | double output_y = output->swayc->current.swayc_y; |
352 | 353 | ||
diff --git a/sway/ipc-server.c b/sway/ipc-server.c index ed710be5..fb5be27b 100644 --- a/sway/ipc-server.c +++ b/sway/ipc-server.c | |||
@@ -253,8 +253,8 @@ int ipc_client_handle_readable(int client_fd, uint32_t mask, void *data) { | |||
253 | return 0; | 253 | return 0; |
254 | } | 254 | } |
255 | 255 | ||
256 | client->payload_length = buf32[0]; | 256 | memcpy(&client->payload_length, &buf32[0], sizeof(buf32[0])); |
257 | client->current_command = (enum ipc_command_type)buf32[1]; | 257 | memcpy(&client->current_command, &buf32[1], sizeof(buf32[1])); |
258 | 258 | ||
259 | if (read_available - received >= (long)client->payload_length) { | 259 | if (read_available - received >= (long)client->payload_length) { |
260 | ipc_client_handle_command(client); | 260 | ipc_client_handle_command(client); |
@@ -832,8 +832,8 @@ bool ipc_send_reply(struct ipc_client *client, const char *payload, uint32_t pay | |||
832 | uint32_t *data32 = (uint32_t*)(data + sizeof(ipc_magic)); | 832 | uint32_t *data32 = (uint32_t*)(data + sizeof(ipc_magic)); |
833 | 833 | ||
834 | memcpy(data, ipc_magic, sizeof(ipc_magic)); | 834 | memcpy(data, ipc_magic, sizeof(ipc_magic)); |
835 | data32[0] = payload_length; | 835 | memcpy(&data32[0], &payload_length, sizeof(payload_length)); |
836 | data32[1] = client->current_command; | 836 | memcpy(&data32[1], &client->current_command, sizeof(client->current_command)); |
837 | 837 | ||
838 | while (client->write_buffer_len + ipc_header_size + payload_length >= | 838 | while (client->write_buffer_len + ipc_header_size + payload_length >= |
839 | client->write_buffer_size) { | 839 | client->write_buffer_size) { |
diff --git a/sway/main.c b/sway/main.c index 7ed10c86..2f05dc38 100644 --- a/sway/main.c +++ b/sway/main.c | |||
@@ -366,13 +366,15 @@ int main(int argc, char **argv) { | |||
366 | return 1; | 366 | return 1; |
367 | } | 367 | } |
368 | 368 | ||
369 | #ifdef __linux__ | 369 | #if defined(__linux__) || defined(__FreeBSD__) |
370 | if (getuid() != geteuid() || getgid() != getegid()) { | 370 | if (getuid() != geteuid() || getgid() != getegid()) { |
371 | #ifdef __linux__ | ||
371 | // Retain capabilities after setuid() | 372 | // Retain capabilities after setuid() |
372 | if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0)) { | 373 | if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0)) { |
373 | wlr_log(WLR_ERROR, "Cannot keep caps after setuid()"); | 374 | wlr_log(WLR_ERROR, "Cannot keep caps after setuid()"); |
374 | exit(EXIT_FAILURE); | 375 | exit(EXIT_FAILURE); |
375 | } | 376 | } |
377 | #endif | ||
376 | suid = true; | 378 | suid = true; |
377 | } | 379 | } |
378 | #endif | 380 | #endif |
@@ -382,7 +384,7 @@ int main(int argc, char **argv) { | |||
382 | detect_proprietary(); | 384 | detect_proprietary(); |
383 | detect_raspi(); | 385 | detect_raspi(); |
384 | 386 | ||
385 | #ifdef __linux__ | 387 | #if defined(__linux__) || defined(__FreeBSD__) |
386 | drop_permissions(suid); | 388 | drop_permissions(suid); |
387 | #endif | 389 | #endif |
388 | // handle SIGTERM signals | 390 | // handle SIGTERM signals |
diff --git a/sway/server.c b/sway/server.c index 8b5bc93c..749365cb 100644 --- a/sway/server.c +++ b/sway/server.c | |||
@@ -140,6 +140,10 @@ bool server_init(struct sway_server *server) { | |||
140 | 140 | ||
141 | void server_fini(struct sway_server *server) { | 141 | void server_fini(struct sway_server *server) { |
142 | // TODO: free sway-specific resources | 142 | // TODO: free sway-specific resources |
143 | #ifdef HAVE_XWAYLAND | ||
144 | wlr_xwayland_destroy(server->xwayland.wlr_xwayland); | ||
145 | #endif | ||
146 | wl_display_destroy_clients(server->wl_display); | ||
143 | wl_display_destroy(server->wl_display); | 147 | wl_display_destroy(server->wl_display); |
144 | list_free(server->dirty_containers); | 148 | list_free(server->dirty_containers); |
145 | list_free(server->transactions); | 149 | list_free(server->transactions); |
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index 60256336..1957d94f 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c | |||
@@ -1,4 +1,4 @@ | |||
1 | #define _XOPEN_SOURCE 500 | 1 | #define _POSIX_C_SOURCE 200809 |
2 | #include <ctype.h> | 2 | #include <ctype.h> |
3 | #include <limits.h> | 3 | #include <limits.h> |
4 | #include <stdbool.h> | 4 | #include <stdbool.h> |
diff --git a/swaybar/ipc.c b/swaybar/ipc.c index c2d05920..0e60c10c 100644 --- a/swaybar/ipc.c +++ b/swaybar/ipc.c | |||
@@ -1,4 +1,4 @@ | |||
1 | #define _XOPEN_SOURCE 500 | 1 | #define _POSIX_C_SOURCE 200809 |
2 | #include <limits.h> | 2 | #include <limits.h> |
3 | #include <string.h> | 3 | #include <string.h> |
4 | #include <strings.h> | 4 | #include <strings.h> |
diff --git a/swaylock/meson.build b/swaylock/meson.build index 63f694b9..675b8c69 100644 --- a/swaylock/meson.build +++ b/swaylock/meson.build | |||
@@ -24,7 +24,16 @@ executable( | |||
24 | install: true | 24 | install: true |
25 | ) | 25 | ) |
26 | 26 | ||
27 | install_data( | 27 | if is_freebsd |
28 | 'pam/swaylock', | 28 | install_data( |
29 | install_dir: sysconfdir + '/pam.d/' | 29 | 'pam/swaylock.freebsd', |
30 | ) | 30 | install_dir: sysconfdir + '/pam.d/', |
31 | rename: 'swaylock' | ||
32 | ) | ||
33 | else | ||
34 | install_data( | ||
35 | 'pam/swaylock.linux', | ||
36 | install_dir: sysconfdir + '/pam.d/', | ||
37 | rename: 'swaylock' | ||
38 | ) | ||
39 | endif | ||
diff --git a/swaylock/pam/swaylock.freebsd b/swaylock/pam/swaylock.freebsd new file mode 100644 index 00000000..603fc185 --- /dev/null +++ b/swaylock/pam/swaylock.freebsd | |||
@@ -0,0 +1,6 @@ | |||
1 | # | ||
2 | # PAM configuration file for the swaylock screen locker. By default, it includes | ||
3 | # the 'passwd' configuration file (see /etc/pam.d/passwd) | ||
4 | # | ||
5 | |||
6 | auth include passwd | ||
diff --git a/swaylock/pam/swaylock b/swaylock/pam/swaylock.linux index 6a36b0d6..6a36b0d6 100644 --- a/swaylock/pam/swaylock +++ b/swaylock/pam/swaylock.linux | |||