summaryrefslogtreecommitdiffstats
path: root/input/ipc.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-02-26 21:44:35 +0100
committerwm4 <wm4@nowhere>2015-02-26 21:44:35 +0100
commita22de99544af562ffa431ab4864b07ec3729088a (patch)
tree52a3de2768fda3182319c221b876644386561fa7 /input/ipc.c
parent0035dbdbb8f33add8a83fa216a4e597de560ec48 (diff)
downloadmpv-a22de99544af562ffa431ab4864b07ec3729088a.tar.bz2
mpv-a22de99544af562ffa431ab4864b07ec3729088a.tar.xz
input: avoid creating world-writeable file with --input-unix-socket
This requires fchmod(), which is not necessarily available everywhere. It also might not work at all. (It does work on Linux.)
Diffstat (limited to 'input/ipc.c')
-rw-r--r--input/ipc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/input/ipc.c b/input/ipc.c
index 2e17fd4fac..486b9db011 100644
--- a/input/ipc.c
+++ b/input/ipc.c
@@ -725,6 +725,10 @@ static void *ipc_thread(void *p)
goto done;
}
+#if HAVE_FCHMOD
+ fchmod(ipc_fd, 0600);
+#endif
+
size_t path_len = strlen(arg->path);
if (path_len >= sizeof(ipc_un.sun_path) - 1) {
MP_ERR(arg, "Could not create IPC socket\n");