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



commit 1254674c488e7b2b7544b89e893bd7ddad655051
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 0b694a7..fc61b4f 100644
--- a/camel/camel-gpg-context.c
+++ b/camel/camel-gpg-context.c
@@ -647,8 +647,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]