[evolution-data-server] camel-stream-process: Avoid call of g_debug() in the fork process
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] camel-stream-process: Avoid call of g_debug() in the fork process
- Date: Mon, 2 Jan 2017 15:05:47 +0000 (UTC)
commit 7f20680c1bc63bb59393c9b67143ac44415ea75d
Author: Milan Crha <mcrha redhat com>
Date: Mon Jan 2 16:04:43 2017 +0100
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.
src/camel/camel-stream-process.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/src/camel/camel-stream-process.c b/src/camel/camel-stream-process.c
index dcbaeaf..2cdd3b4 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 ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]