aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-gpg-context.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2003-12-06 02:15:17 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2003-12-06 02:15:17 +0800
commit4df8998b86b5056b08d4ab622267304a3abc7ac0 (patch)
treeb30450351407d3c7ad396dd7989ac3130093bac0 /camel/camel-gpg-context.c
parent28d6afea597f3eaaa28915f6e9694814290adc8a (diff)
downloadgsoc2013-evolution-4df8998b86b5056b08d4ab622267304a3abc7ac0.tar.gz
gsoc2013-evolution-4df8998b86b5056b08d4ab622267304a3abc7ac0.tar.zst
gsoc2013-evolution-4df8998b86b5056b08d4ab622267304a3abc7ac0.zip
Properly set the O_NONBLOCK flag along with any previously set flags.
2003-12-05 Jeffrey Stedfast <fejj@ximian.com> * camel-gpg-context.c (gpg_ctx_op_start): Properly set the O_NONBLOCK flag along with any previously set flags. * camel-filter-search.c (run_command): Don't set O_NONBLOCK on the pipe (1. we don't need to, and 2. we should have been setting O_NONBLOCK|prev_flags but we weren't, and so the pipe got O_RDONLY|O_NONBLOCK even tho we wanted to write to it). * camel-filter-driver.c (pipe_to_system): Same. svn path=/trunk/; revision=23651
Diffstat (limited to 'camel/camel-gpg-context.c')
-rw-r--r--camel/camel-gpg-context.c19
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;