From: Ronnie Sahlberg Date: Sat, 13 Apr 2013 14:40:46 +0000 (-0700) Subject: AROS: add inet_pton emulation and make sure we use recv/send and not read/write X-Git-Tag: upstream/1.9.6^2~222 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=9a9126c3d94e38c9e0ad7d4f0ba442b96a156ca6;p=deb_libnfs.git AROS: add inet_pton emulation and make sure we use recv/send and not read/write --- diff --git a/aros/aros_compat.c b/aros/aros_compat.c index 92da9a3..9a6cd3b 100644 --- a/aros/aros_compat.c +++ b/aros/aros_compat.c @@ -78,8 +78,11 @@ void aros_freeaddrinfo(struct addrinfo *res) int aros_inet_pton(int af, char *src, void *dst) { - printf("No inet_pton yet"); - exit(10); + struct sockaddr_in sin; + + sin.sin_addr.s_addr = inet_addr(src); + memcpy(dst, &sin.sin_addr.s_addr, sizeof(sin.sin_addr,s_addr)); + return 1; } diff --git a/lib/socket.c b/lib/socket.c index 1dbbdea..9b16b1b 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -118,7 +118,7 @@ static int rpc_write_to_socket(struct rpc_context *rpc) total = rpc->outqueue->outdata.size; -#if defined(WIN32) +#if defined(WIN32) | defined(AROS) count = send(rpc->fd, rpc->outqueue->outdata.data + rpc->outqueue->written, total - rpc->outqueue->written, 0); #else count = write(rpc->fd, rpc->outqueue->outdata.data + rpc->outqueue->written, total - rpc->outqueue->written); @@ -202,7 +202,7 @@ static int rpc_read_from_socket(struct rpc_context *rpc) if (rpc->inpos < 4) { size = 4 - rpc->inpos; -#if defined(WIN32) +#if defined(WIN32) | defined(AROS) count = recv(rpc->fd, rpc->inbuf + rpc->inpos, size, 0); #else count = read(rpc->fd, rpc->inbuf + rpc->inpos, size); @@ -242,7 +242,7 @@ static int rpc_read_from_socket(struct rpc_context *rpc) size = rpc->insize - rpc->inpos; } -#if defined(WIN32) +#if defined(WIN32) | defined(AROS) count = recv(rpc->fd, rpc->inbuf + rpc->inpos, size, 0); #else count = read(rpc->fd, rpc->inbuf + rpc->inpos, size);