aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcus Brinkmann <[email protected]>2003-04-25 13:23:27 +0000
committerMarcus Brinkmann <[email protected]>2003-04-25 13:23:27 +0000
commitd5993c256bd053454173b95e21481749d5c68c0e (patch)
treeb1cb7aca1fc54408f73fe5042a3d34976b9817a8
parent2003-04-25 Marcus Brinkmann <[email protected]> (diff)
downloadgpgme-d5993c256bd053454173b95e21481749d5c68c0e.tar.gz
gpgme-d5993c256bd053454173b95e21481749d5c68c0e.zip
2003-04-25 Marcus Brinkmann <[email protected]>
* data.c: Do not include <assert.h>, but "gpgme.h". (_gpgme_data_inbound_handler): Expand _gpgme_data_append, because it will go. Do not assert DH. (_gpgme_data_outbound_handler): Do not assert DH.
-rw-r--r--gpgme/ChangeLog5
-rw-r--r--gpgme/data.c18
2 files changed, 17 insertions, 6 deletions
diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog
index ba6e2966..4fed18e4 100644
--- a/gpgme/ChangeLog
+++ b/gpgme/ChangeLog
@@ -1,5 +1,10 @@
2003-04-25 Marcus Brinkmann <[email protected]>
+ * data.c: Do not include <assert.h>, but "gpgme.h".
+ (_gpgme_data_inbound_handler): Expand _gpgme_data_append, because
+ it will go. Do not assert DH.
+ (_gpgme_data_outbound_handler): Do not assert DH.
+
* export.c: Do not include <stdlib.h>, "debug.h" and "util.h", but
"gpgme.h".
(export_status_handler): Change type of first argument to void *.
diff --git a/gpgme/data.c b/gpgme/data.c
index 038307e9..cd606aa1 100644
--- a/gpgme/data.c
+++ b/gpgme/data.c
@@ -22,11 +22,11 @@
#endif
#include <stdlib.h>
-#include <assert.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
+#include "gpgme.h"
#include "data.h"
#include "util.h"
#include "ops.h"
@@ -164,10 +164,9 @@ _gpgme_data_inbound_handler (void *opaque, int fd)
{
GpgmeData dh = (GpgmeData) opaque;
char buffer[BUFFER_SIZE];
+ char *bufp = buffer;
ssize_t buflen;
- assert (dh);
-
buflen = read (fd, buffer, BUFFER_SIZE);
if (buflen < 0)
return GPGME_File_Error;
@@ -177,7 +176,16 @@ _gpgme_data_inbound_handler (void *opaque, int fd)
return 0;
}
- return _gpgme_data_append (dh, buffer, buflen);
+ do
+ {
+ ssize_t amt = gpgme_data_write (dh, bufp, buflen);
+ if (amt == 0 || (amt < 0 && errno != EINTR))
+ return GPGME_File_Error;
+ bufp += amt;
+ buflen -= amt;
+ }
+ while (buflen > 0);
+ return 0;
}
@@ -187,8 +195,6 @@ _gpgme_data_outbound_handler (void *opaque, int fd)
GpgmeData dh = (GpgmeData) opaque;
ssize_t nwritten;
- assert (dh);
-
if (!dh->pending_len)
{
ssize_t amt = gpgme_data_read (dh, dh->pending, BUFFER_SIZE);