aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/util.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-06-10 13:02:59 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-06-10 13:02:59 +0100
commit980d8b7d6b4369491bd99df633a8ad88100e9986 (patch)
tree37508d45f5c2056861edcbd760bc666cae8a90a6 /src/libutil/util.c
parent5dac1cff96ff04cc43d690d3cbaf7ba23b8abaa7 (diff)
downloadrspamd-980d8b7d6b4369491bd99df633a8ad88100e9986.tar.gz
rspamd-980d8b7d6b4369491bd99df633a8ad88100e9986.zip
[Minor] Explicitly specify af for socketpair
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) {