From 7602d165397aae3fc83e3a7b1efe1c0df2044572 Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Tue, 13 Mar 2018 17:00:26 +0100 Subject: lib: Use sequenced datagrams with UNIX sockets The UNIX sockets were using SOCK_STREAM, which does not preserve the message boundaries. This switches to SOCK_SEQPACKET. Signed-off-by: Sander Vrijders Signed-off-by: Dimitri Staessens --- src/lib/sockets.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib') diff --git a/src/lib/sockets.c b/src/lib/sockets.c index 9e5bbe17..6e7d4ad5 100644 --- a/src/lib/sockets.c +++ b/src/lib/sockets.c @@ -38,7 +38,7 @@ int client_socket_open(char * file_name) int sockfd; struct sockaddr_un serv_addr; - sockfd = socket(AF_UNIX, SOCK_STREAM, 0); + sockfd = socket(AF_UNIX, SOCK_SEQPACKET, 0); if (sockfd < 0) return -1; @@ -66,7 +66,7 @@ int server_socket_open(char * file_name) return -1; } - sockfd = socket(AF_UNIX, SOCK_STREAM, 0); + sockfd = socket(AF_UNIX, SOCK_SEQPACKET, 0); if (sockfd < 0) return -1; -- cgit v1.2.3