aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/util.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-07-25 08:41:27 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-07-25 08:41:27 +0100
commit29820f8a7bd23a446a5dee829d812295c254a487 (patch)
tree6afb87c17f7382caa360c995d95bae2e148ca473 /src/libutil/util.c
parentd0a8583ef8638704aea83cdaa0bcdcce3656631b (diff)
downloadrspamd-29820f8a7bd23a446a5dee829d812295c254a487.tar.gz
rspamd-29820f8a7bd23a446a5dee829d812295c254a487.zip
[Minor] Use rspamd_socketpair everywhere
Diffstat (limited to 'src/libutil/util.c')
-rw-r--r--src/libutil/util.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/libutil/util.c b/src/libutil/util.c
index 86f1f24f6..b94de00b9 100644
--- a/src/libutil/util.c
+++ b/src/libutil/util.c
@@ -604,22 +604,27 @@ err:
}
gboolean
-rspamd_socketpair (gint pair[2])
+rspamd_socketpair (gint pair[2], gboolean is_stream)
{
gint r, serrno;
+ if (!is_stream) {
#ifdef HAVE_SOCK_SEQPACKET
- r = socketpair (AF_LOCAL, SOCK_SEQPACKET, 0, pair);
+ r = socketpair (AF_LOCAL, SOCK_SEQPACKET, 0, pair);
- if (r == -1) {
- msg_warn ("seqpacket socketpair failed: %d, '%s'",
- errno,
- strerror (errno));
- r = socketpair (AF_LOCAL, SOCK_DGRAM, 0, pair);
- }
+ if (r == -1) {
+ msg_warn ("seqpacket socketpair failed: %d, '%s'",
+ errno,
+ strerror (errno));
+ r = socketpair (AF_LOCAL, SOCK_DGRAM, 0, pair);
+ }
#else
- r = socketpair (AF_LOCAL, SOCK_DGRAM, 0, pair);
+ r = socketpair (AF_LOCAL, SOCK_DGRAM, 0, pair);
#endif
+ }
+ else {
+ r = socketpair (AF_LOCAL, SOCK_STREAM, 0, pair);
+ }
if (r == -1) {
msg_warn ("socketpair failed: %d, '%s'", errno, strerror (