From: Marcus Brinkmann Date: Thu, 5 May 2005 12:00:11 +0000 (+0000) Subject: 2005-05-05 Marcus Brinkmann X-Git-Tag: gpgme-1.2.0@1385~327 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=468cfa8223e9309ba1916b1ac129f0e8a270a556;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/trunk/gpgme/ChangeLog b/trunk/gpgme/ChangeLog index 275db84..98f81a0 100644 --- a/trunk/gpgme/ChangeLog +++ b/trunk/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/trunk/gpgme/data-user.c b/trunk/gpgme/data-user.c index 8a71b88..cfd3105 100644 --- a/trunk/gpgme/data-user.c +++ b/trunk/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); }