config: Fix socket/wl_client leaks when executing child processes

Added spawn_wl_client helper function that is used for spawning both bar and
background processes
This commit is contained in:
Pavel Shramov 2019-05-14 09:08:59 +03:00
parent 9670ccee68
commit 9fca1c785a
6 changed files with 185 additions and 213 deletions

14
include/sway/util.h Normal file
View file

@ -0,0 +1,14 @@
#ifndef _SWAY_SWAY_UTIL_H
#define _SWAY_SWAY_UTIL_H
#include <spawn.h>
/**
* Close fd and log theoretical case when close(2) failed
*/
void close_warn(int fd);
struct wl_client *spawn_wl_client(char * const cmd[], struct wl_display *display);
struct wl_client *spawn_wl_client_fa(char * const cmd[], struct wl_display *display, posix_spawn_file_actions_t *fa);
#endif//_SWAY_SWAY_UTIL_H