2004-09-30 Marcus Brinkmann <marcus@g10code.de>
* rungpg.c (read_status): Move the polling of the output data pipe to just before removing the command fd, from just before adding it. This avoids buffering problems.
This commit is contained in:
parent
a2d38f6824
commit
1819293208
@ -1,5 +1,9 @@
|
|||||||
2004-09-30 Marcus Brinkmann <marcus@g10code.de>
|
2004-09-30 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
|
* rungpg.c (read_status): Move the polling of the output data pipe
|
||||||
|
to just before removing the command fd, from just before adding
|
||||||
|
it. This avoids buffering problems.
|
||||||
|
|
||||||
* data.c (_gpgme_data_inbound_handler): Use _gpgme_io_read, not
|
* data.c (_gpgme_data_inbound_handler): Use _gpgme_io_read, not
|
||||||
read, to improve debug output.
|
read, to improve debug output.
|
||||||
|
|
||||||
|
@ -841,29 +841,6 @@ read_status (engine_gpg_t gpg)
|
|||||||
if (nread > 1)
|
if (nread > 1)
|
||||||
DEBUG0 ("ERROR, unexpected data in read_status");
|
DEBUG0 ("ERROR, unexpected data in read_status");
|
||||||
|
|
||||||
/* Before we can actually add the command
|
|
||||||
fd, we might have to flush the linked
|
|
||||||
output data pipe. */
|
|
||||||
if (gpg->cmd.linked_idx != -1
|
|
||||||
&& gpg->fd_data_map[gpg->cmd.linked_idx].fd != -1)
|
|
||||||
{
|
|
||||||
struct io_select_fd_s fds;
|
|
||||||
fds.fd = gpg->fd_data_map[gpg->cmd.linked_idx].fd;
|
|
||||||
fds.for_read = 1;
|
|
||||||
fds.for_write = 0;
|
|
||||||
fds.frozen = 0;
|
|
||||||
fds.opaque = NULL;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
fds.signaled = 0;
|
|
||||||
_gpgme_io_select (&fds, 1, 1);
|
|
||||||
if (fds.signaled)
|
|
||||||
_gpgme_data_inbound_handler
|
|
||||||
(gpg->cmd.linked_data, fds.fd);
|
|
||||||
}
|
|
||||||
while (fds.signaled);
|
|
||||||
}
|
|
||||||
|
|
||||||
add_io_cb (gpg, gpg->cmd.fd, 0,
|
add_io_cb (gpg, gpg->cmd.fd, 0,
|
||||||
command_handler, gpg,
|
command_handler, gpg,
|
||||||
&gpg->fd_data_map[gpg->cmd.idx].tag);
|
&gpg->fd_data_map[gpg->cmd.idx].tag);
|
||||||
@ -883,6 +860,31 @@ read_status (engine_gpg_t gpg)
|
|||||||
{
|
{
|
||||||
if (gpg->cmd.used)
|
if (gpg->cmd.used)
|
||||||
{
|
{
|
||||||
|
/* Before we can actually add the
|
||||||
|
command fd, we might have to flush
|
||||||
|
the linked output data pipe. */
|
||||||
|
if (gpg->cmd.linked_idx != -1
|
||||||
|
&& gpg->fd_data_map[gpg->cmd.linked_idx].fd
|
||||||
|
!= -1)
|
||||||
|
{
|
||||||
|
struct io_select_fd_s fds;
|
||||||
|
fds.fd =
|
||||||
|
gpg->fd_data_map[gpg->cmd.linked_idx].fd;
|
||||||
|
fds.for_read = 1;
|
||||||
|
fds.for_write = 0;
|
||||||
|
fds.frozen = 0;
|
||||||
|
fds.opaque = NULL;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
fds.signaled = 0;
|
||||||
|
_gpgme_io_select (&fds, 1, 1);
|
||||||
|
if (fds.signaled)
|
||||||
|
_gpgme_data_inbound_handler
|
||||||
|
(gpg->cmd.linked_data, fds.fd);
|
||||||
|
}
|
||||||
|
while (fds.signaled);
|
||||||
|
}
|
||||||
|
|
||||||
/* XXX We must check if there are any
|
/* XXX We must check if there are any
|
||||||
more fds active after removing this
|
more fds active after removing this
|
||||||
one. */
|
one. */
|
||||||
|
Loading…
Reference in New Issue
Block a user