summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2017-01-02 16:04:43 +0100
committerMilan Crha <mcrha@redhat.com>2017-01-02 16:04:43 +0100
commit7f20680c1bc63bb59393c9b67143ac44415ea75d (patch)
tree5062bb0ed0f87e78246209eb0b0c507fe20bdc04
parentbb31f37767634fa2a2f356ee26740ac33fdd503f (diff)
downloadevolution-data-server-7f20680c1bc63bb59393c9b67143ac44415ea75d.tar.gz
camel-stream-process: Avoid call of g_debug() in the fork process
The call to g_debug(), and eventually also g_strerror() in the fork process could cause deadlocks on mutexes in GLib in certain situations, thus rather do not call it at all.
-rw-r--r--src/camel/camel-stream-process.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/camel/camel-stream-process.c b/src/camel/camel-stream-process.c
index dcbaeaff2..2cdd3b445 100644
--- a/src/camel/camel-stream-process.c
+++ b/src/camel/camel-stream-process.c
@@ -38,12 +38,6 @@
#include "camel-file-utils.h"
#include "camel-stream-process.h"
-#define CHECK_CALL(x) G_STMT_START { \
- if ((x) == -1) { \
- g_debug ("%s: Call of '" #x "' failed: %s", G_STRFUNC, g_strerror (errno)); \
- } \
- } G_STMT_END
-
extern gint camel_verbose_debug;
struct _CamelStreamProcessPrivate {
@@ -217,7 +211,13 @@ do_exec_command (gint fd,
maxopen = sysconf (_SC_OPEN_MAX);
for (i = 3; i < maxopen; i++) {
- CHECK_CALL (fcntl (i, F_SETFD, FD_CLOEXEC));
+ if (fcntl (i, F_SETFD, FD_CLOEXEC) == -1 && errno != EBADF) {
+ /* Would g_debug() this, but it can cause deadlock on mutexes
+ in GLib in certain situations, thus rather ignore it at all.
+ It's also quite likely, definitely in the early stage, that
+ most of the file descriptors are not valid anyway. */
+ /* g_debug ("%s: Call of 'fcntl (%d, F_SETFD, FD_CLOEXEC)' failed: %s", G_STRFUNC, i, g_strerror (errno)); */
+ }
}
setsid ();