[evolution-data-server/evolution-data-server-3-12] Bug 741786 - Gets stuck while closing fds before execing gpg



commit 46b678b59521d762175dec2587d2b30d8888a946
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Jan 5 16:51:41 2015 +0100

    Bug 741786 - Gets stuck while closing fds before execing gpg
    
    Printing the error message to stdout after we have redirected it to
    the parent process causes the write system call to get stuck.

 camel/camel-gpg-context.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/camel/camel-gpg-context.c b/camel/camel-gpg-context.c
index ea2cb84..73fd723 100644
--- a/camel/camel-gpg-context.c
+++ b/camel/camel-gpg-context.c
@@ -648,8 +648,12 @@ gpg_ctx_op_start (struct _GpgCtx *gpg,
                /* Loop over all fds. */
                for (i = 3; i < maxfd; i++) {
                        /* don't close the status-fd or passwd-fd */
-                       if (i != fds[7] && i != fds[8])
-                               CHECK_CALL (fcntl (i, F_SETFD, FD_CLOEXEC));
+                       if (i != fds[7] && i != fds[8]) {
+                               if (fcntl (i, F_SETFD, FD_CLOEXEC) == -1) {
+                                       /* Do nothing here. Cannot use CHECK_CALL() macro here, because
+                                          it makes the process stuck, possibly due to the debug print. */
+                               }
+                       }
                }
 
                /* run gpg */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]