The unix(7) man page recommends using SOCK_SEQPACKET

Since Linux 2.6.4 the SOCK_SEQPACKET socket type is available for UNIX
domain sockets on Linux.  It is intended for; "a sequenced-packet socket
that is connection-oriented, preserves message boundaries, and delivers
messages in the order that they were sent." which sounds like us.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2021-03-25 17:26:55 +01:00
1 parent a260e157eb
commit 1845b7be54
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -444,7 +444,7 @@ int api_init(uev_ctx_t *ctx)
}; };
_d("Setting up external API socket ..."); _d("Setting up external API socket ...");
sd = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0); sd = socket(AF_UNIX, SOCK_SEQPACKET | SOCK_CLOEXEC, 0);
if (-1 == sd) { if (-1 == sd) {
_pe("Failed starting external API socket"); _pe("Failed starting external API socket");
return 1; return 1;
+1 -1
View File
@@ -38,7 +38,7 @@ int client_connect(void)
.sun_path = INIT_SOCKET, .sun_path = INIT_SOCKET,
}; };
sd = socket(AF_UNIX, SOCK_STREAM, 0); sd = socket(AF_UNIX, SOCK_SEQPACKET, 0);
if (-1 == sd) if (-1 == sd)
err(1, "Failed creating UNIX domain socket"); err(1, "Failed creating UNIX domain socket");