summaryrefslogtreecommitdiffstats
path: root/video/out/wayland_common.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-07-21 15:14:37 +0200
committerwm4 <wm4@nowhere>2016-07-21 15:18:32 +0200
commit16d276308acb88c607d832f743d7d75d8bf9e420 (patch)
tree81a7bfabe1318efe6f30ba631cb34a3172e299ff /video/out/wayland_common.c
parentb4acfcc8aae49e0d0cca03d8abe3f7ed8e7279ff (diff)
downloadmpv-16d276308acb88c607d832f743d7d75d8bf9e420.tar.bz2
mpv-16d276308acb88c607d832f743d7d75d8bf9e420.tar.xz
x11, wayland: do not accidentally close FD 0
Both backends have code to close each FD of their wakeup_pipe array. This array is default-initialized with 0, which means if the backends exit before the wakeup pipe is created (e.g. when probing), they would close FD 0. Initialize the FDs with -1. Then we call close(-1) in these situations, which is perfectly allowed and has no bad consequences.
Diffstat (limited to 'video/out/wayland_common.c')
-rw-r--r--video/out/wayland_common.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index 75c9ead470..839dd69251 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -1009,8 +1009,11 @@ int vo_wayland_init(struct vo *vo)
{
vo->wayland = talloc_zero(NULL, struct vo_wayland_state);
struct vo_wayland_state *wl = vo->wayland;
- wl->vo = vo;
- wl->log = mp_log_new(wl, vo->log, "wayland");
+ *wl = (struct vo_wayland_state){
+ .vo = vo,
+ .log = mp_log_new(wl, vo->log, "wayland"),
+ .wakeup_pipe = {-1, -1},
+ };
wl_list_init(&wl->display.output_list);