Skip to content

Commit 09cba8c

Browse files
committed
Merge pull request #171 from dpejesh/socket
minor socket/mmap fixes
2 parents a1011c5 + dfa7874 commit 09cba8c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lib/ipc_socket.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ qb_ipc_dgram_sock_setup(const char *base_name,
8484
#endif
8585
res = bind(request_fd, (struct sockaddr *)&local_address,
8686
sizeof(local_address));
87+
#if !(defined(QB_LINUX) || defined(QB_CYGWIN))
88+
chmod(local_address.sun_path, 0660);
89+
#endif
8790
if (res < 0) {
8891
goto error_connect;
8992
}

lib/unix.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ qb_sys_mmap_file_open(char *path, const char *file, size_t bytes,
8383
#if defined(QB_LINUX) || defined(QB_CYGWIN)
8484
snprintf(path, PATH_MAX, "/dev/shm/%s", file);
8585
#else
86-
snprintf(path, PATH_MAX, LOCALSTATEDIR "/run/%s", file);
86+
snprintf(path, PATH_MAX, "%s/%s", SOCKETDIR, file);
8787
is_absolute = path;
8888
#endif
8989
}
9090
fd = open_mmap_file(path, file_flags);
9191
if (fd < 0 && !is_absolute) {
9292
qb_util_perror(LOG_ERR, "couldn't open file %s", path);
9393

94-
snprintf(path, PATH_MAX, LOCALSTATEDIR "/run/%s", file);
94+
snprintf(path, PATH_MAX, "%s/%s", SOCKETDIR, file);
9595
fd = open_mmap_file(path, file_flags);
9696
if (fd < 0) {
9797
res = -errno;

0 commit comments

Comments
 (0)