From: Marcus Brinkmann Date: Thu, 5 May 2005 12:00:11 +0000 (+0000) Subject: 2005-05-05 Marcus Brinkmann X-Git-Tag: gpgme-1-1-0~43 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1184d349cd494088cdc22acc87ac5898173c995e;p=gpgme.git 2005-05-05 Marcus Brinkmann * data-user.c (user_release): Only call user hook if provided. (user_seek): Return EBADF if no user hook is provided. (user_read): Likewise. (user_write): Likewise. --- diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index 275db84..98f81a0 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,3 +1,10 @@ +2005-05-05 Marcus Brinkmann + + * data-user.c (user_release): Only call user hook if provided. + (user_seek): Return EBADF if no user hook is provided. + (user_read): Likewise. + (user_write): Likewise. + 2005-04-28 Marcus Brinkmann * gpgme.h (GPGME_INCLUDE_CERTS_DEFAULT): New macro. diff --git a/gpgme/data-user.c b/gpgme/data-user.c index 8a71b88..cfd3105 100644 --- a/gpgme/data-user.c +++ b/gpgme/data-user.c @@ -30,6 +30,9 @@ static ssize_t user_read (gpgme_data_t dh, void *buffer, size_t size) { + if (!dh->data.user.cbs->read) + return EBADF; + return (*dh->data.user.cbs->read) (dh->data.user.handle, buffer, size); } @@ -37,6 +40,9 @@ user_read (gpgme_data_t dh, void *buffer, size_t size) static ssize_t user_write (gpgme_data_t dh, const void *buffer, size_t size) { + if (!dh->data.user.cbs->write) + return EBADF; + return (*dh->data.user.cbs->write) (dh->data.user.handle, buffer, size); } @@ -44,6 +50,9 @@ user_write (gpgme_data_t dh, const void *buffer, size_t size) static off_t user_seek (gpgme_data_t dh, off_t offset, int whence) { + if (!dh->data.user.cbs->seek) + return EBADF; + return (*dh->data.user.cbs->seek) (dh->data.user.handle, offset, whence); } @@ -51,7 +60,8 @@ user_seek (gpgme_data_t dh, off_t offset, int whence) static void user_release (gpgme_data_t dh) { - (*dh->data.user.cbs->release) (dh->data.user.handle); + if (dh->data.user.cbs->release) + (*dh->data.user.cbs->release) (dh->data.user.handle); }