2007-07-13 Marcus Brinkmann <marcus@g10code.de>

* 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.
This commit is contained in:
Marcus Brinkmann 2007-07-13 14:47:07 +00:00
parent 5d25b54f30
commit d258f5f735
4 changed files with 22 additions and 5 deletions

View File

@ -1,5 +1,10 @@
2007-07-13 Marcus Brinkmann <marcus@g10code.de> 2007-07-13 Marcus Brinkmann <marcus@g10code.de>
* 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 * Revert the "close_notify_handler" returns int stuff. Always
close in the _gpgme_io_close implementations. close in the _gpgme_io_close implementations.
* engine-gpgsm.c (status_handler): Try to terminate the connection * engine-gpgsm.c (status_handler): Try to terminate the connection

View File

@ -167,7 +167,10 @@ old_user_seek (gpgme_data_t dh, off_t offset, int whence)
{ {
gpgme_error_t err; gpgme_error_t err;
if (whence != SEEK_SET || offset) 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); err = (*dh->data.old_user.cb) (dh->data.old_user.handle, NULL, 0, NULL);
if (err) if (err)
return gpgme_error_to_errno (err); return gpgme_error_to_errno (err);

View File

@ -32,7 +32,10 @@ static ssize_t
user_read (gpgme_data_t dh, void *buffer, size_t size) user_read (gpgme_data_t dh, void *buffer, size_t size)
{ {
if (!dh->data.user.cbs->read) if (!dh->data.user.cbs->read)
return EBADF; {
errno = EBADF;
return -1;
}
return (*dh->data.user.cbs->read) (dh->data.user.handle, buffer, size); 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) user_write (gpgme_data_t dh, const void *buffer, size_t size)
{ {
if (!dh->data.user.cbs->write) if (!dh->data.user.cbs->write)
return EBADF; {
errno = EBADF;
return -1;
}
return (*dh->data.user.cbs->write) (dh->data.user.handle, buffer, size); 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) user_seek (gpgme_data_t dh, off_t offset, int whence)
{ {
if (!dh->data.user.cbs->seek) if (!dh->data.user.cbs->seek)
return EBADF; {
errno = EBADF;
return -1;
}
return (*dh->data.user.cbs->seek) (dh->data.user.handle, offset, whence); return (*dh->data.user.cbs->seek) (dh->data.user.handle, offset, whence);
} }

View File

@ -471,7 +471,7 @@ gpgme_sig_notation_add (gpgme_ctx_t ctx, const char *name,
gpgme_sig_notation_t *lastp; gpgme_sig_notation_t *lastp;
if (!ctx) if (!ctx)
gpg_error (GPG_ERR_INV_VALUE); return gpg_error (GPG_ERR_INV_VALUE);
if (name) if (name)
flags |= GPGME_SIG_NOTATION_HUMAN_READABLE; flags |= GPGME_SIG_NOTATION_HUMAN_READABLE;