From 8567bed308f7b34e572ea93add664171c3e92613 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Thu, 23 Sep 2004 19:23:33 +0000 Subject: [PATCH] 2004-09-23 Marcus Brinkmann * data.c (_gpgme_data_outbound_handler): Close the file descriptor if we get an EPIPE. --- trunk/gpgme/ChangeLog | 4 ++++ trunk/gpgme/data.c | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/trunk/gpgme/ChangeLog b/trunk/gpgme/ChangeLog index 039b197..57177e8 100644 --- a/trunk/gpgme/ChangeLog +++ b/trunk/gpgme/ChangeLog @@ -1,5 +1,8 @@ 2004-09-23 Marcus Brinkmann + * data.c (_gpgme_data_outbound_handler): Close the file descriptor + if we get an EPIPE. + * data-stream.c (stream_seek): Call ftello and return the current offset. * data.h (struct gpgme_data): Change type of data.mem.offset to @@ -8,6 +11,7 @@ callback. If SEEK_CUR, adjust the offset by the pending buffer size. Clear pending buffer on success. + 2004-09-14 Marcus Brinkmann * gpgme.m4: Add copyright notice. diff --git a/trunk/gpgme/data.c b/trunk/gpgme/data.c index aba1986..e4e13a3 100644 --- a/trunk/gpgme/data.c +++ b/trunk/gpgme/data.c @@ -219,9 +219,19 @@ _gpgme_data_outbound_handler (void *opaque, int fd) } nwritten = _gpgme_io_write (fd, dh->pending, dh->pending_len); - if (nwritten == -1 && errno == EAGAIN ) + if (nwritten == -1 && errno == EAGAIN) return 0; + if (nwritten == -1 && errno == EPIPE) + { + /* Not much we can do. The other end closed the pipe, but we + still have data. This should only ever happen if the other + end is going to tell us what happened on some other channel. + Silently close our end. */ + _gpgme_io_close (fd); + return 0; + } + if (nwritten <= 0) return gpg_error_from_errno (errno); -- 2.26.2