diff options
author | Muhamed Hobi <woohoomoo2u@gmail.com> | 2022-02-07 19:03:54 -0500 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2022-02-08 09:43:32 +0100 |
commit | ac7892371ce1ef7a05619492f0896f525b4dbdc3 (patch) | |
tree | a88179e4d50e08b41f95689e0bf766a9a8041943 | |
parent | xdg-shell: use wlr_xdg_popup in sway_xdg_popup (diff) | |
download | sway-ac7892371ce1ef7a05619492f0896f525b4dbdc3.tar.gz sway-ac7892371ce1ef7a05619492f0896f525b4dbdc3.tar.zst sway-ac7892371ce1ef7a05619492f0896f525b4dbdc3.zip |
Fix snprintf compiler warning
-rw-r--r-- | sway/commands/output/background.c | 2 | ||||
-rw-r--r-- | sway/server.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/sway/commands/output/background.c b/sway/commands/output/background.c index 68ee9fe1..1a3939d4 100644 --- a/sway/commands/output/background.c +++ b/sway/commands/output/background.c | |||
@@ -112,7 +112,7 @@ struct cmd_results *output_cmd_background(int argc, char **argv) { | |||
112 | "Unable to allocate resources"); | 112 | "Unable to allocate resources"); |
113 | } | 113 | } |
114 | 114 | ||
115 | sprintf(src, "%s/%s", conf_path, rel_path); | 115 | snprintf(src, strlen(conf_path) + strlen(src) + 2, "%s/%s", conf_path, rel_path); |
116 | free(rel_path); | 116 | free(rel_path); |
117 | free(conf); | 117 | free(conf); |
118 | } | 118 | } |
diff --git a/sway/server.c b/sway/server.c index 567e6ae4..8de9f629 100644 --- a/sway/server.c +++ b/sway/server.c | |||
@@ -214,7 +214,7 @@ bool server_init(struct sway_server *server) { | |||
214 | // Avoid using "wayland-0" as display socket | 214 | // Avoid using "wayland-0" as display socket |
215 | char name_candidate[16]; | 215 | char name_candidate[16]; |
216 | for (int i = 1; i <= 32; ++i) { | 216 | for (int i = 1; i <= 32; ++i) { |
217 | sprintf(name_candidate, "wayland-%d", i); | 217 | snprintf(name_candidate, sizeof(name_candidate), "wayland-%d", i); |
218 | if (wl_display_add_socket(server->wl_display, name_candidate) >= 0) { | 218 | if (wl_display_add_socket(server->wl_display, name_candidate) >= 0) { |
219 | server->socket = strdup(name_candidate); | 219 | server->socket = strdup(name_candidate); |
220 | break; | 220 | break; |