From 108a26169b92ef466efaefe5cc157b91f96579e4 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Fri, 13 Jul 2007 14:47:07 +0000 Subject: [PATCH] 2007-07-13 Marcus Brinkmann * data-user.c (user_read, user_write, user_seek): Set errno and return -1 instead returning the error code directly. * data-compat.c (old_user_seek): Likewise. * gpgme.c (gpgme_sig_notation_add): Return error properly. --- trunk/gpgme/ChangeLog | 5 +++++ trunk/gpgme/data-compat.c | 5 ++++- trunk/gpgme/data-user.c | 15 ++++++++++++--- trunk/gpgme/gpgme.c | 2 +- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/trunk/gpgme/ChangeLog b/trunk/gpgme/ChangeLog index 716b29c..fb00f9c 100644 --- a/trunk/gpgme/ChangeLog +++ b/trunk/gpgme/ChangeLog @@ -1,5 +1,10 @@ 2007-07-13 Marcus Brinkmann + * data-user.c (user_read, user_write, user_seek): Set errno and + return -1 instead returning the error code directly. + * data-compat.c (old_user_seek): Likewise. + * gpgme.c (gpgme_sig_notation_add): Return error properly. + * Revert the "close_notify_handler" returns int stuff. Always close in the _gpgme_io_close implementations. * engine-gpgsm.c (status_handler): Try to terminate the connection diff --git a/trunk/gpgme/data-compat.c b/trunk/gpgme/data-compat.c index 91fa6be..b808cbd 100644 --- a/trunk/gpgme/data-compat.c +++ b/trunk/gpgme/data-compat.c @@ -167,7 +167,10 @@ old_user_seek (gpgme_data_t dh, off_t offset, int whence) { gpgme_error_t err; if (whence != SEEK_SET || offset) - return EINVAL; + { + errno = EINVAL; + return -1; + } err = (*dh->data.old_user.cb) (dh->data.old_user.handle, NULL, 0, NULL); if (err) return gpgme_error_to_errno (err); diff --git a/trunk/gpgme/data-user.c b/trunk/gpgme/data-user.c index 90a0f42..ca9e9b1 100644 --- a/trunk/gpgme/data-user.c +++ b/trunk/gpgme/data-user.c @@ -32,7 +32,10 @@ static ssize_t user_read (gpgme_data_t dh, void *buffer, size_t size) { if (!dh->data.user.cbs->read) - return EBADF; + { + errno = EBADF; + return -1; + } return (*dh->data.user.cbs->read) (dh->data.user.handle, buffer, size); } @@ -42,7 +45,10 @@ static ssize_t user_write (gpgme_data_t dh, const void *buffer, size_t size) { if (!dh->data.user.cbs->write) - return EBADF; + { + errno = EBADF; + return -1; + } return (*dh->data.user.cbs->write) (dh->data.user.handle, buffer, size); } @@ -52,7 +58,10 @@ static off_t user_seek (gpgme_data_t dh, off_t offset, int whence) { if (!dh->data.user.cbs->seek) - return EBADF; + { + errno = EBADF; + return -1; + } return (*dh->data.user.cbs->seek) (dh->data.user.handle, offset, whence); } diff --git a/trunk/gpgme/gpgme.c b/trunk/gpgme/gpgme.c index 6604cb0..36eefb2 100644 --- a/trunk/gpgme/gpgme.c +++ b/trunk/gpgme/gpgme.c @@ -471,7 +471,7 @@ gpgme_sig_notation_add (gpgme_ctx_t ctx, const char *name, gpgme_sig_notation_t *lastp; if (!ctx) - gpg_error (GPG_ERR_INV_VALUE); + return gpg_error (GPG_ERR_INV_VALUE); if (name) flags |= GPGME_SIG_NOTATION_HUMAN_READABLE; -- 2.26.2