diff options
Diffstat (limited to 'camel/camel-gpg-context.c')
-rw-r--r-- | camel/camel-gpg-context.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/camel/camel-gpg-context.c b/camel/camel-gpg-context.c index 237540a381..f7f52fd7fd 100644 --- a/camel/camel-gpg-context.c +++ b/camel/camel-gpg-context.c @@ -557,6 +557,7 @@ gpg_ctx_op_start (struct _GpgCtx *gpg) char *status_fd = NULL, *passwd_fd = NULL; int i, maxfd, errnosave, fds[10]; GPtrArray *argv; + int flags; for (i = 0; i < 10; i++) fds[i] = -1; @@ -617,13 +618,21 @@ gpg_ctx_op_start (struct _GpgCtx *gpg) if (gpg->need_passwd) { close (fds[8]); gpg->passwd_fd = fds[9]; - fcntl (gpg->passwd_fd, F_SETFL, O_NONBLOCK); + flags = fcntl (gpg->passwd_fd, F_GETFL); + fcntl (gpg->passwd_fd, F_SETFL, flags | O_NONBLOCK); } - fcntl (gpg->stdin_fd, F_SETFL, O_NONBLOCK); - fcntl (gpg->stdout_fd, F_SETFL, O_NONBLOCK); - fcntl (gpg->stderr_fd, F_SETFL, O_NONBLOCK); - fcntl (gpg->status_fd, F_SETFL, O_NONBLOCK); + flags = fcntl (gpg->stdin_fd, F_GETFL); + fcntl (gpg->stdin_fd, F_SETFL, flags | O_NONBLOCK); + + flags = fcntl (gpg->stdout_fd, F_GETFL); + fcntl (gpg->stdout_fd, F_SETFL, flags | O_NONBLOCK); + + flags = fcntl (gpg->stderr_fd, F_GETFL); + fcntl (gpg->stderr_fd, F_SETFL, flags | O_NONBLOCK); + + flags = fcntl (gpg->status_fd, F_GETFL); + fcntl (gpg->status_fd, F_SETFL, flags | O_NONBLOCK); return 0; |