From d258f5f735d427137b5490f5e3b56fa6ba2f7f2f 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. --- gpgme/ChangeLog | 5 +++++ gpgme/data-compat.c | 5 ++++- gpgme/data-user.c | 15 ++++++++++++--- gpgme/gpgme.c | 2 +- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index 716b29c..fb00f9c 100644 --- a/gpgme/ChangeLog +++ b/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/gpgme/data-compat.c b/gpgme/data-compat.c index 91fa6be..b808cbd 100644 --- a/gpgme/data-compat.c +++ b/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/gpgme/data-user.c b/gpgme/data-user.c index 90a0f42..ca9e9b1 100644 --- a/gpgme/data-user.c +++ b/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/gpgme/gpgme.c b/gpgme/gpgme.c index 6604cb0..36eefb2 100644 --- a/gpgme/gpgme.c +++ b/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