From 4df8998b86b5056b08d4ab622267304a3abc7ac0 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 5 Dec 2003 18:15:17 +0000 Subject: Properly set the O_NONBLOCK flag along with any previously set flags. 2003-12-05 Jeffrey Stedfast * 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 --- camel/ChangeLog | 12 ++++++++++++ camel/camel-filter-driver.c | 1 - camel/camel-filter-search.c | 4 +--- camel/camel-gpg-context.c | 19 ++++++++++++++----- 4 files changed, 27 insertions(+), 9 deletions(-) (limited to 'camel') diff --git a/camel/ChangeLog b/camel/ChangeLog index ed23215906..e17021ce51 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,15 @@ +2003-12-05 Jeffrey Stedfast + + * 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. + 2003-12-04 Radek Doulik * camel-folder.c (folder_changed): check recent messages for junk diff --git a/camel/camel-filter-driver.c b/camel/camel-filter-driver.c index 75836dea67..1282188eb0 100644 --- a/camel/camel-filter-driver.c +++ b/camel/camel-filter-driver.c @@ -715,7 +715,6 @@ pipe_to_system (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFil /* parent process */ close (fds[0]); - fcntl (fds[1], F_SETFL, O_NONBLOCK); close (fds[3]); stream = camel_stream_fs_new_with_fd (fds[1]); diff --git a/camel/camel-filter-search.c b/camel/camel-filter-search.c index 42f04b0f22..53fe074b10 100644 --- a/camel/camel-filter-search.c +++ b/camel/camel-filter-search.c @@ -553,12 +553,10 @@ run_command (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessa /* parent process */ close (in_fds[0]); - fcntl (in_fds[1], F_SETFL, O_NONBLOCK); - - stream = camel_stream_fs_new_with_fd (in_fds[1]); message = camel_filter_search_get_message (fms, f); + stream = camel_stream_fs_new_with_fd (in_fds[1]); camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), stream); camel_stream_flush (stream); camel_object_unref (stream); 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; -- cgit