aboutsummaryrefslogtreecommitdiffstats
path: root/lib/receiver.c
diff options
context:
space:
mode:
authorGeorge Kiagiadakis <george.kiagiadakis@collabora.com>2021-05-06 14:05:59 +0300
committerGeorge Kiagiadakis <george.kiagiadakis@collabora.com>2021-07-28 13:19:02 +0300
commit2409371e084c6f34e21b27e533ee7d6feca3f471 (patch)
tree16371850dc6a12bcb50b1700201e0e39ed2e0055 /lib/receiver.c
parenta189af3e9d74c0cca520e6913f68d5f5f614befc (diff)
wpipc: place sockets in the same runtime directory as pipewire
Signed-off-by: George Kiagiadakis <george.kiagiadakis@collabora.com>
Diffstat (limited to 'lib/receiver.c')
-rw-r--r--lib/receiver.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/receiver.c b/lib/receiver.c
index 4592916..b58e8be 100644
--- a/lib/receiver.c
+++ b/lib/receiver.c
@@ -107,14 +107,12 @@ icipc_receiver_new (const char *path,
size_t user_size)
{
struct icipc_receiver *self;
- int name_size;
+ int res;
/* check params */
if (path == NULL || buffer_size == 0)
return NULL;
- unlink (path);
-
self = calloc (1, sizeof (struct icipc_receiver) + user_size);
if (self == NULL)
return NULL;
@@ -123,11 +121,12 @@ icipc_receiver_new (const char *path,
/* set address */
self->addr.sun_family = AF_LOCAL;
- name_size = snprintf(self->addr.sun_path, sizeof(self->addr.sun_path), "%s",
- path) + 1;
- if (name_size > (int) sizeof(self->addr.sun_path))
+ res = icipc_construct_socket_path (path, self->addr.sun_path, sizeof(self->addr.sun_path));
+ if (res < 0)
goto error;
+ unlink (self->addr.sun_path);
+
/* create socket */
self->socket_fd =
socket(PF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0);