diff options
author | 2019-01-17 11:20:08 +0100 | |
---|---|---|
committer | 2019-01-17 11:20:08 +0100 | |
commit | fe3f4882edf81d4e72f77948a99cfa94af7998f8 (patch) | |
tree | a660dfb5799539e1b44a009daf06b4c4b91c1044 /sway | |
parent | swaybg: use wl_surface_damage_buffer (diff) | |
download | sway-fe3f4882edf81d4e72f77948a99cfa94af7998f8.tar.gz sway-fe3f4882edf81d4e72f77948a99cfa94af7998f8.tar.zst sway-fe3f4882edf81d4e72f77948a99cfa94af7998f8.zip |
Don't use sh when spawning swaybg
Diffstat (limited to 'sway')
-rw-r--r-- | sway/config/output.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/sway/config/output.c b/sway/config/output.c index 2cbfa3cd..f23d316d 100644 --- a/sway/config/output.c +++ b/sway/config/output.c | |||
@@ -232,28 +232,21 @@ void apply_output_config(struct output_config *oc, struct sway_output *output) { | |||
232 | wlr_log(WLR_DEBUG, "Setting background for output %s to %s", | 232 | wlr_log(WLR_DEBUG, "Setting background for output %s to %s", |
233 | wlr_output->name, oc->background); | 233 | wlr_output->name, oc->background); |
234 | 234 | ||
235 | size_t len = snprintf(NULL, 0, "%s \"%s\" \"%s\" %s %s", | 235 | char *const cmd[] = { |
236 | config->swaybg_command, wlr_output->name, oc->background, | 236 | config->swaybg_command, |
237 | wlr_output->name, | ||
238 | oc->background, | ||
237 | oc->background_option, | 239 | oc->background_option, |
238 | oc->background_fallback ? oc->background_fallback : ""); | 240 | oc->background_fallback ? oc->background_fallback : NULL, |
239 | char *command = malloc(len + 1); | 241 | NULL, |
240 | if (!command) { | 242 | }; |
241 | wlr_log(WLR_DEBUG, "Unable to allocate swaybg command"); | ||
242 | return; | ||
243 | } | ||
244 | snprintf(command, len + 1, "%s \"%s\" \"%s\" %s %s", | ||
245 | config->swaybg_command, wlr_output->name, oc->background, | ||
246 | oc->background_option, | ||
247 | oc->background_fallback ? oc->background_fallback : ""); | ||
248 | wlr_log(WLR_DEBUG, "-> %s", command); | ||
249 | 243 | ||
250 | char *const cmd[] = { "sh", "-c", command, NULL }; | ||
251 | output->bg_pid = fork(); | 244 | output->bg_pid = fork(); |
252 | if (output->bg_pid == 0) { | 245 | if (output->bg_pid < 0) { |
246 | wlr_log_errno(WLR_ERROR, "fork failed"); | ||
247 | } else if (output->bg_pid == 0) { | ||
253 | execvp(cmd[0], cmd); | 248 | execvp(cmd[0], cmd); |
254 | wlr_log_errno(WLR_ERROR, "Failed to execute swaybg"); | 249 | wlr_log_errno(WLR_ERROR, "Failed to execute swaybg"); |
255 | } else { | ||
256 | free(command); | ||
257 | } | 250 | } |
258 | } | 251 | } |
259 | 252 | ||