aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config.h.in3
-rw-r--r--src/libserver/rspamd_control.c2
-rw-r--r--src/libserver/worker_util.c4
-rw-r--r--src/libutil/util.c23
-rw-r--r--src/libutil/util.h2
-rw-r--r--src/log_helper.c7
-rw-r--r--src/lua/lua_fann.c2
7 files changed, 24 insertions, 19 deletions
diff --git a/config.h.in b/config.h.in
index 2b9773aea..8e89c04ff 100644
--- a/config.h.in
+++ b/config.h.in
@@ -58,7 +58,8 @@
#cmakedefine HAVE_NFTW 1
#cmakedefine HAVE_OASYNC 1
#cmakedefine HAVE_ONOFOLLOW 1
-#cmakedefine HAVE_OPENSSL 1
+#cmakedefine HAVE_OCLOEXEC 1
+#cmakedefine HAVE_OPENSSL 1
#cmakedefine HAVE_O_DIRECT 1
#cmakedefine HAVE_PATH_MAX 1
#cmakedefine HAVE_PCRE_JIT 1
diff --git a/src/libserver/rspamd_control.c b/src/libserver/rspamd_control.c
index ab317bde2..6853bb242 100644
--- a/src/libserver/rspamd_control.c
+++ b/src/libserver/rspamd_control.c
@@ -844,7 +844,7 @@ rspamd_srv_handler (gint fd, short what, gpointer ud)
if (spair == NULL) {
spair = g_malloc (sizeof (gint) * 2);
- if (rspamd_socketpair (spair) == -1) {
+ if (rspamd_socketpair (spair, 0) == -1) {
rdata->rep.reply.spair.code = errno;
msg_err ("cannot create socket pair: %s", strerror (errno));
}
diff --git a/src/libserver/worker_util.c b/src/libserver/worker_util.c
index 9791c1989..fa510d335 100644
--- a/src/libserver/worker_util.c
+++ b/src/libserver/worker_util.c
@@ -533,12 +533,12 @@ rspamd_fork_worker (struct rspamd_main *rspamd_main,
/* Starting worker process */
wrk = (struct rspamd_worker *) g_malloc0 (sizeof (struct rspamd_worker));
- if (!rspamd_socketpair (wrk->control_pipe)) {
+ if (!rspamd_socketpair (wrk->control_pipe, 0)) {
msg_err ("socketpair failure: %s", strerror (errno));
rspamd_hard_terminate (rspamd_main);
}
- if (!rspamd_socketpair (wrk->srv_pipe)) {
+ if (!rspamd_socketpair (wrk->srv_pipe, 0)) {
msg_err ("socketpair failure: %s", strerror (errno));
rspamd_hard_terminate (rspamd_main);
}
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 (
diff --git a/src/libutil/util.h b/src/libutil/util.h
index 7f6ccc2f6..315554a4c 100644
--- a/src/libutil/util.h
+++ b/src/libutil/util.h
@@ -75,7 +75,7 @@ GList * rspamd_sockets_list (const gchar *credits,
/*
* Create socketpair
*/
-gboolean rspamd_socketpair (gint pair[2]);
+gboolean rspamd_socketpair (gint pair[2], gboolean is_stream);
/*
* Write pid to file
diff --git a/src/log_helper.c b/src/log_helper.c
index 0f98a5579..942a536a1 100644
--- a/src/log_helper.c
+++ b/src/log_helper.c
@@ -203,10 +203,9 @@ start_log_helper (struct rspamd_worker *worker)
DL_COUNT (worker->cf->scripts, tmp, nscripts);
msg_info ("started log_helper worker with %d scripts", nscripts);
-#ifdef HAVE_SOCK_SEQPACKET
- r = socketpair (AF_LOCAL, SOCK_SEQPACKET, 0, ctx->pair);
-#endif
- if (r == -1 && socketpair (AF_LOCAL, SOCK_DGRAM, 0, ctx->pair) == -1) {
+ r = rspamd_socketpair (ctx->pair, FALSE);
+
+ if (r == -1) {
msg_err ("cannot create socketpair: %s, exiting now", strerror (errno));
/* Prevent new processes spawning */
exit (EXIT_SUCCESS);
diff --git a/src/lua/lua_fann.c b/src/lua/lua_fann.c
index b74174fb7..4f00dba28 100644
--- a/src/lua/lua_fann.c
+++ b/src/lua/lua_fann.c
@@ -708,7 +708,7 @@ lua_fann_train_threaded (lua_State *L)
lua_pushvalue (L, 4);
cbdata->cbref = luaL_ref (L, LUA_REGISTRYINDEX);
- if (rspamd_socketpair (cbdata->pair) == -1) {
+ if (rspamd_socketpair (cbdata->pair, 0) == -1) {
msg_err ("cannot open socketpair: %s", strerror (errno));
cbdata->pair[0] = -1;
cbdata->pair[1] = -1;