The variable is called RET and not RC.

This commit is contained in:
Werner Koch 2009-06-29 08:54:18 +00:00
parent 86491ca816
commit 19cb96e5d3
2 changed files with 52 additions and 4 deletions

View File

@ -1,3 +1,7 @@
2009-06-29 Werner Koch <wk@g10code.com>
* estream.c (es_write_sanitized_utf8_buffer): Typo typo fix.
2009-06-25 Werner Koch <wk@g10code.com>
* estream.c (es_write_sanitized_utf8_buffer): Typo fix.
@ -12,6 +16,11 @@
* sexputil.c (get_rsa_pk_from_canon_sexp): Check for error after
the loop. Reported by Fabian Keil.
2009-06-22 Werner Koch <wk@g10code.com>
* estream.c (es_pth_read, es_pth_write) [W32]: New.
(ESTREAM_SYS_READ, ESTREAM_SYS_WRITE) [HAVE_PTH]: Use them.
2009-06-03 Werner Koch <wk@g10code.com>
* estream.c (es_convert_mode): Rewrite and support the "x" flag.

View File

@ -138,8 +138,8 @@ dummy_mutex_call_int (estream_mutex_t mutex)
/* Primitive system I/O. */
#ifdef HAVE_PTH
# define ESTREAM_SYS_READ pth_read
# define ESTREAM_SYS_WRITE pth_write
# define ESTREAM_SYS_READ es_pth_read
# define ESTREAM_SYS_WRITE es_pth_write
#else
# define ESTREAM_SYS_READ read
# define ESTREAM_SYS_WRITE write
@ -231,7 +231,7 @@ static estream_mutex_t estream_list_lock;
while (0)
/* Malloc wrappers to overcvome problems on some older OSes. */
/* Malloc wrappers to overcome problems on some older OSes. */
static void *
mem_alloc (size_t n)
{
@ -325,6 +325,45 @@ es_list_iterate (estream_iterator_t iterator)
return ret;
}
/*
* I/O Helper
*
* Unfortunately our Pth emulation for Windows expects system handles
* for pth_read and pth_write. We use a simple approach to fix this:
* If the function returns an error we fall back to a vanilla read or
* write, assuming that we do I/O on a plain file where the operation
* can't block.
*/
#ifdef HAVE_PTH
static int
es_pth_read (int fd, void *buffer, size_t size)
{
# ifdef HAVE_W32_SYSTEM
int rc = pth_read (fd, buffer, size);
if (rc == -1 && errno == EINVAL)
rc = read (fd, buffer, size);
return rc;
# else /*!HAVE_W32_SYSTEM*/
return pth_read (fd, buffer, size);
# endif /* !HAVE_W32_SYSTEM*/
}
static int
es_pth_write (int fd, const void *buffer, size_t size)
{
# ifdef HAVE_W32_SYSTEM
int rc = pth_write (fd, buffer, size);
if (rc == -1 && errno == EINVAL)
rc = write (fd, buffer, size);
return rc;
# else /*!HAVE_W32_SYSTEM*/
return pth_write (fd, buffer, size);
# endif /* !HAVE_W32_SYSTEM*/
}
#endif /*HAVE_PTH*/
/*
@ -3205,7 +3244,7 @@ es_write_sanitized_utf8_buffer (estream_t stream,
*bytes_written = strlen (buf);
ret = es_fputs (buf, stream);
xfree (buf);
return rc == EOF? ret : (int)i;
return ret == EOF? ret : (int)i;
}
else
return es_write_sanitized (stream, p, length, delimiters, bytes_written);