aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil/util.c')
-rw-r--r--src/libutil/util.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/libutil/util.c b/src/libutil/util.c
index 3dc1adea1..60328df32 100644
--- a/src/libutil/util.c
+++ b/src/libutil/util.c
@@ -442,23 +442,21 @@ rspamd_socket (const gchar *credits, guint16 port,
}
gboolean
-rspamd_socketpair (gint pair[2], gboolean is_stream)
+rspamd_socketpair (gint pair[2], gint af)
{
- gint r, serrno;
+ gint r = -1, serrno;
- if (!is_stream) {
#ifdef HAVE_SOCK_SEQPACKET
+ if (af == SOCK_SEQPACKET) {
r = socketpair (AF_LOCAL, SOCK_SEQPACKET, 0, pair);
if (r == -1) {
r = socketpair (AF_LOCAL, SOCK_DGRAM, 0, pair);
}
-#else
- r = socketpair (AF_LOCAL, SOCK_DGRAM, 0, pair);
-#endif
}
- else {
- r = socketpair (AF_LOCAL, SOCK_STREAM, 0, pair);
+#endif
+ if (r == -1) {
+ r = socketpair (AF_LOCAL, af, 0, pair);
}
if (r == -1) {