Skip to content

Commit

Permalink
Merge pull request #171 from dpejesh/socket
Browse files Browse the repository at this point in the history
minor socket/mmap fixes
  • Loading branch information
chrissie-c committed Jan 19, 2016
2 parents a1011c5 + dfa7874 commit 09cba8c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions lib/ipc_socket.c
Expand Up @@ -84,6 +84,9 @@ qb_ipc_dgram_sock_setup(const char *base_name,
#endif
res = bind(request_fd, (struct sockaddr *)&local_address,
sizeof(local_address));
#if !(defined(QB_LINUX) || defined(QB_CYGWIN))
chmod(local_address.sun_path, 0660);
#endif
if (res < 0) {
goto error_connect;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/unix.c
Expand Up @@ -83,15 +83,15 @@ qb_sys_mmap_file_open(char *path, const char *file, size_t bytes,
#if defined(QB_LINUX) || defined(QB_CYGWIN)
snprintf(path, PATH_MAX, "/dev/shm/%s", file);
#else
snprintf(path, PATH_MAX, LOCALSTATEDIR "/run/%s", file);
snprintf(path, PATH_MAX, "%s/%s", SOCKETDIR, file);
is_absolute = path;
#endif
}
fd = open_mmap_file(path, file_flags);
if (fd < 0 && !is_absolute) {
qb_util_perror(LOG_ERR, "couldn't open file %s", path);

snprintf(path, PATH_MAX, LOCALSTATEDIR "/run/%s", file);
snprintf(path, PATH_MAX, "%s/%s", SOCKETDIR, file);
fd = open_mmap_file(path, file_flags);
if (fd < 0) {
res = -errno;
Expand Down

0 comments on commit 09cba8c

Please sign in to comment.