diff options
Diffstat (limited to 'assuan/assuan-uds.c')
| -rw-r--r-- | assuan/assuan-uds.c | 36 | 
1 files changed, 18 insertions, 18 deletions
| diff --git a/assuan/assuan-uds.c b/assuan/assuan-uds.c index 70ec8ccc..02f77a52 100644 --- a/assuan/assuan-uds.c +++ b/assuan/assuan-uds.c @@ -14,9 +14,7 @@   * Lesser General Public License for more details.   *   * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA.  + * License along with this program; if not, see <http://www.gnu.org/licenses/>.   */  #ifdef HAVE_CONFIG_H @@ -72,9 +70,9 @@  static ssize_t  uds_reader (assuan_context_t ctx, void *buf, size_t buflen)  { +#ifndef HAVE_W32_SYSTEM    int len = ctx->uds.buffersize; -#ifndef HAVE_W32_SYSTEM    if (!ctx->uds.bufferallocated)      {        ctx->uds.buffer = xtrymalloc (2048); @@ -141,12 +139,6 @@ uds_reader (assuan_context_t ctx, void *buf, size_t buflen)  #endif /*USE_DESCRIPTOR_PASSING*/      } -#else /*HAVE_W32_SYSTEM*/ - -  len = recvfrom (ctx->inbound.fd, buf, buflen, 0, NULL, NULL); - -#endif /*HAVE_W32_SYSTEM*/ -    /* Return some data to the user.  */    if (len > buflen) /* We have more than the user requested.  */ @@ -159,6 +151,12 @@ uds_reader (assuan_context_t ctx, void *buf, size_t buflen)    assert (ctx->uds.bufferoffset <= ctx->uds.bufferallocated);    return len; +#else /*HAVE_W32_SYSTEM*/ +  int res = recvfrom (HANDLE2SOCKET(ctx->inbound.fd), buf, buflen, 0, NULL, NULL); +  if (res < 0) +    errno = _assuan_sock_wsa2errno (WSAGetLastError ()); +  return res; +#endif /*HAVE_W32_SYSTEM*/  } @@ -181,19 +179,21 @@ uds_writer (assuan_context_t ctx, const void *buf, size_t buflen)    iovec.iov_len = buflen;    len = _assuan_simple_sendmsg (ctx, &msg); + +  return len;  #else /*HAVE_W32_SYSTEM*/ -  int len; -   -  len = sendto (ctx->outbound.fd, buf, buflen, 0, -                (struct sockaddr *)&ctx->serveraddr, -                sizeof (struct sockaddr_in)); +  int res = sendto (HANDLE2SOCKET(ctx->outbound.fd), buf, buflen, 0, +		    (struct sockaddr *)&ctx->serveraddr, +		    sizeof (struct sockaddr_in)); +  if (res < 0) +    errno = _assuan_sock_wsa2errno (WSAGetLastError ()); +  return res;  #endif /*HAVE_W32_SYSTEM*/ -  return len;  }  static assuan_error_t -uds_sendfd (assuan_context_t ctx, int fd) +uds_sendfd (assuan_context_t ctx, assuan_fd_t fd)  {  #ifdef USE_DESCRIPTOR_PASSING    struct msghdr msg; @@ -243,7 +243,7 @@ uds_sendfd (assuan_context_t ctx, int fd)  static assuan_error_t -uds_receivefd (assuan_context_t ctx, int *fd) +uds_receivefd (assuan_context_t ctx, assuan_fd_t *fd)  {  #ifdef USE_DESCRIPTOR_PASSING    int i; | 
