aboutsummaryrefslogtreecommitdiff
path: root/kms/client
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2023-12-31 15:44:37 +0100
committerdec05eba <dec05eba@protonmail.com>2023-12-31 15:44:43 +0100
commit54b03eabbd8eb481da707ee31bd716ae9806b80f (patch)
tree9a15d84aeced9ed49226609b455c35507395de48 /kms/client
parent84f9a042729ca76b3b56e824fede202cc6d2897b (diff)
Fix for opensuse: set unix domain socket mod 777
Fixes screen capture on opensuse amd/intel or nvidia wayland
Diffstat (limited to 'kms/client')
-rw-r--r--kms/client/kms_client.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/kms/client/kms_client.c b/kms/client/kms_client.c
index bcd6870..0b28b48 100644
--- a/kms/client/kms_client.c
+++ b/kms/client/kms_client.c
@@ -10,6 +10,7 @@
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/wait.h>
+#include <sys/stat.h>
#include <sys/capability.h>
#define GSR_SOCKET_PAIR_LOCAL 0
@@ -229,7 +230,12 @@ int gsr_kms_client_init(gsr_kms_client *self, const char *card_path) {
local_addr.sun_family = AF_UNIX;
strncpy_safe(local_addr.sun_path, self->initial_socket_path, sizeof(local_addr.sun_path));
- if(bind(self->initial_socket_fd, (struct sockaddr*)&local_addr, sizeof(local_addr.sun_family) + strlen(local_addr.sun_path)) == -1) {
+
+ const mode_t prev_mask = umask(0000);
+ int bind_res = bind(self->initial_socket_fd, (struct sockaddr*)&local_addr, sizeof(local_addr.sun_family) + strlen(local_addr.sun_path));
+ umask(prev_mask);
+
+ if(bind_res == -1) {
fprintf(stderr, "gsr error: gsr_kms_client_init: failed to bind socket, error: %s\n", strerror(errno));
goto err;
}