* assuan-buffer.c (writen,readline) [USE_GNU_PT]: Use pth_read/write.

* assuan-socket-server.c (accept_connection) [USE_GNU_PTH]: Ditto.
This commit is contained in:
Werner Koch 2002-02-12 20:41:34 +00:00
parent eeb5cdb962
commit ebb00fa843
3 changed files with 23 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2002-02-12 Werner Koch <wk@gnupg.org>
* assuan-buffer.c (writen,readline) [USE_GNU_PT]: Use pth_read/write.
* assuan-socket-server.c (accept_connection) [USE_GNU_PTH]: Ditto.
2002-02-01 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am (MOSTLYCLEANFILES): New variable.

View File

@ -25,7 +25,9 @@
#include <errno.h>
#include <unistd.h>
#include <assert.h>
#ifdef USE_GNU_PTH
# include <pth.h>
#endif
#include "assuan-defs.h"
@ -34,7 +36,11 @@ writen ( int fd, const char *buffer, size_t length )
{
while (length)
{
#ifdef USE_GNU_PTH
int nwritten = pth_write (fd, buffer, length);
#else
int nwritten = write (fd, buffer, length);
#endif
if (nwritten < 0)
{
@ -59,7 +65,11 @@ readline (int fd, char *buf, size_t buflen, int *r_nread, int *eof)
*r_nread = 0;
while (nleft > 0)
{
#ifdef USE_GNU_PTH
int n = pth_read (fd, buf, nleft);
#else
int n = read (fd, buf, nleft);
#endif
if (n < 0)
{
if (errno == EINTR)

View File

@ -25,6 +25,9 @@
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>
#ifdef USE_GNU_PTH
# include <pth.h>
#endif
#include "assuan-defs.h"
@ -35,7 +38,11 @@ accept_connection (ASSUAN_CONTEXT ctx)
struct sockaddr_un clnt_addr;
size_t len = sizeof clnt_addr;
#ifdef USE_GNU_PTH
fd = pth_accept (ctx->listen_fd, (struct sockaddr*)&clnt_addr, &len );
#else
fd = accept (ctx->listen_fd, (struct sockaddr*)&clnt_addr, &len );
#endif
if (fd == -1)
{
ctx->os_errno = errno;