frontend: Add FDSTR_INIT macro
This initialises fdstr to 'safe' values so we can reliably deinit them. Signed-off-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
parent
97421545b4
commit
17331a0c7d
|
@ -396,7 +396,7 @@ weston_client_launch(struct weston_compositor *compositor,
|
||||||
{
|
{
|
||||||
struct wl_client *client = NULL;
|
struct wl_client *client = NULL;
|
||||||
struct custom_env child_env;
|
struct custom_env child_env;
|
||||||
struct fdstr wayland_socket;
|
struct fdstr wayland_socket = FDSTR_INIT;
|
||||||
const char *fail_cloexec = "Couldn't unset CLOEXEC on client socket";
|
const char *fail_cloexec = "Couldn't unset CLOEXEC on client socket";
|
||||||
const char *fail_seteuid = "Couldn't call seteuid";
|
const char *fail_seteuid = "Couldn't call seteuid";
|
||||||
char *fail_exec;
|
char *fail_exec;
|
||||||
|
|
|
@ -96,11 +96,11 @@ spawn_xserver(void *user_data, const char *display, int abstract_fd, int unix_fd
|
||||||
{
|
{
|
||||||
struct wet_xwayland *wxw = user_data;
|
struct wet_xwayland *wxw = user_data;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
struct fdstr wayland_socket;
|
struct fdstr wayland_socket = FDSTR_INIT;
|
||||||
struct fdstr x11_abstract_socket;
|
struct fdstr x11_abstract_socket = FDSTR_INIT;
|
||||||
struct fdstr x11_unix_socket;
|
struct fdstr x11_unix_socket = FDSTR_INIT;
|
||||||
struct fdstr x11_wm_socket;
|
struct fdstr x11_wm_socket = FDSTR_INIT;
|
||||||
struct fdstr display_pipe;
|
struct fdstr display_pipe = FDSTR_INIT;
|
||||||
char *xserver = NULL;
|
char *xserver = NULL;
|
||||||
struct weston_config *config = wet_get_config(wxw->compositor);
|
struct weston_config *config = wet_get_config(wxw->compositor);
|
||||||
struct weston_config_section *section;
|
struct weston_config_section *section;
|
||||||
|
|
|
@ -68,7 +68,8 @@ fdstr_close_all(struct fdstr *s)
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_LENGTH(s->fds); i++) {
|
for (i = 0; i < ARRAY_LENGTH(s->fds); i++) {
|
||||||
close(s->fds[i]);
|
if (s->fds[i] >= 0)
|
||||||
|
close(s->fds[i]);
|
||||||
s->fds[i] = -1;
|
s->fds[i] = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,7 @@ fdstr_clear_cloexec_fd1(struct fdstr *s);
|
||||||
void
|
void
|
||||||
fdstr_close_all(struct fdstr *s);
|
fdstr_close_all(struct fdstr *s);
|
||||||
|
|
||||||
|
#define FDSTR_INIT ((struct fdstr){ { 0 }, { -1, -1 }})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A container for environment variables and/or process arguments, designed to
|
* A container for environment variables and/or process arguments, designed to
|
||||||
|
|
Loading…
Reference in New Issue