aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.c
diff options
context:
space:
mode:
authorMarcus Brinkmann <[email protected]>2010-05-06 13:39:55 +0000
committerMarcus Brinkmann <[email protected]>2010-05-06 13:39:55 +0000
commit749325d6c10fd6a8d8fafa3c9c25b6822eaf0dc5 (patch)
tree5e43ee1064a9e68208c7ab288e08e89c814caa5f /src/data.c
parent2010-04-19 Marcus Brinkmann <[email protected]> (diff)
downloadgpgme-749325d6c10fd6a8d8fafa3c9c25b6822eaf0dc5.tar.gz
gpgme-749325d6c10fd6a8d8fafa3c9c25b6822eaf0dc5.zip
2010-05-06 Marcus Brinkmann <[email protected]>
* configure.ac: Require libgpg-error 1.8. src/ 2010-05-06 Marcus Brinkmann <[email protected]> * sign.c, data-user.c, conversion.c, debug.c, verify.c, data.c, decrypt.c, delete.c, assuan-support.c, import.c, engine-gpgsm.c, data-mem.c, op-support.c, w32-io.c, w32-util.c, data-compat.c: Use gpg_error_from_syserror instead gpg_error_from_errno, and use gpg_err_set_errno to set error number. * setenv.c: Include <gpg-error.h> and define __set_errno to use gpg_err_set_errno. * gpgme-tool.c (ARGP_ERR_UNKNOWN): Define to EDEADLOCK (which is mapped in Windows CE) instead of E2BIG (which is not). (gt_import_keys): Initialize err.
Diffstat (limited to 'src/data.c')
-rw-r--r--src/data.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/data.c b/src/data.c
index 408aeab6..be64ef07 100644
--- a/src/data.c
+++ b/src/data.c
@@ -46,7 +46,7 @@ _gpgme_data_new (gpgme_data_t *r_dh, struct _gpgme_data_cbs *cbs)
*r_dh = NULL;
dh = calloc (1, sizeof (*dh));
if (!dh)
- return gpg_error_from_errno (errno);
+ return gpg_error_from_syserror ();
dh->cbs = cbs;
@@ -79,12 +79,12 @@ gpgme_data_read (gpgme_data_t dh, void *buffer, size_t size)
if (!dh)
{
- errno = EINVAL;
+ gpg_err_set_errno (EINVAL);
return TRACE_SYSRES (-1);
}
if (!dh->cbs->read)
{
- errno = ENOSYS;
+ gpg_err_set_errno (ENOSYS);
return TRACE_SYSRES (-1);
}
do
@@ -107,12 +107,12 @@ gpgme_data_write (gpgme_data_t dh, const void *buffer, size_t size)
if (!dh)
{
- errno = EINVAL;
+ gpg_err_set_errno (EINVAL);
return TRACE_SYSRES (-1);
}
if (!dh->cbs->write)
{
- errno = ENOSYS;
+ gpg_err_set_errno (ENOSYS);
return TRACE_SYSRES (-1);
}
do
@@ -134,12 +134,12 @@ gpgme_data_seek (gpgme_data_t dh, off_t offset, int whence)
if (!dh)
{
- errno = EINVAL;
+ gpg_err_set_errno (EINVAL);
return TRACE_SYSRES (-1);
}
if (!dh->cbs->seek)
{
- errno = ENOSYS;
+ gpg_err_set_errno (ENOSYS);
return TRACE_SYSRES (-1);
}
@@ -216,7 +216,7 @@ gpgme_data_set_file_name (gpgme_data_t dh, const char *file_name)
{
dh->file_name = strdup (file_name);
if (!dh->file_name)
- return TRACE_ERR (gpg_error_from_errno (errno));
+ return TRACE_ERR (gpg_error_from_syserror ());
}
else
dh->file_name = 0;
@@ -257,7 +257,7 @@ _gpgme_data_inbound_handler (void *opaque, int fd)
buflen = _gpgme_io_read (fd, buffer, BUFFER_SIZE);
if (buflen < 0)
- return gpg_error_from_errno (errno);
+ return gpg_error_from_syserror ();
if (buflen == 0)
{
_gpgme_io_close (fd);
@@ -268,7 +268,7 @@ _gpgme_data_inbound_handler (void *opaque, int fd)
{
ssize_t amt = gpgme_data_write (dh, bufp, buflen);
if (amt == 0 || (amt < 0 && errno != EINTR))
- return TRACE_ERR (gpg_error_from_errno (errno));
+ return TRACE_ERR (gpg_error_from_syserror ());
bufp += amt;
buflen -= amt;
}
@@ -290,7 +290,7 @@ _gpgme_data_outbound_handler (void *opaque, int fd)
{
ssize_t amt = gpgme_data_read (dh, dh->pending, BUFFER_SIZE);
if (amt < 0)
- return TRACE_ERR (gpg_error_from_errno (errno));
+ return TRACE_ERR (gpg_error_from_syserror ());
if (amt == 0)
{
_gpgme_io_close (fd);
@@ -314,7 +314,7 @@ _gpgme_data_outbound_handler (void *opaque, int fd)
}
if (nwritten <= 0)
- return TRACE_ERR (gpg_error_from_errno (errno));
+ return TRACE_ERR (gpg_error_from_syserror ());
if (nwritten < dh->pending_len)
memmove (dh->pending, dh->pending + nwritten, dh->pending_len - nwritten);