[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[tyndur-devel] [PATCH] libc: POSIX: Fix fuer Socket-Strukturen
! libc: POSIX: sin_addr ist nicht direkt eine 32-Bit-Zahl, sondern eine
struct, die die IP-Adresse kapselt
---
src/modules/include/netinet/in.h | 12 ++++++------
src/modules/lib/posix/socket.c | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/modules/include/netinet/in.h b/src/modules/include/netinet/in.h
index 2dc3b8e..a620b88 100644
--- a/src/modules/include/netinet/in.h
+++ b/src/modules/include/netinet/in.h
@@ -33,18 +33,18 @@
#include <stdint.h>
#include <arpa/inet.h>
+typedef uint32_t in_addr_t;
+struct in_addr {
+ in_addr_t s_addr;
+};
+
/// Adresse fuer das INET-Protokol (IPv4)
struct sockaddr_in {
sa_family_t sin_family;
- uint32_t sin_addr;
+ struct in_addr sin_addr;
uint32_t sin_port;
};
-typedef uint32_t in_addr_t;
-struct in_addr {
- in_addr_t s_addr;
-};
-
/**
* Wandelt einen String, der eine IP-Adresse der Form a.b.c.d enthaelt in einen
* 32-Bit-Wert um.
diff --git a/src/modules/lib/posix/socket.c b/src/modules/lib/posix/socket.c
index b8941d7..29333f9 100644
--- a/src/modules/lib/posix/socket.c
+++ b/src/modules/lib/posix/socket.c
@@ -138,7 +138,7 @@ int connect(int sock, struct sockaddr* address, socklen_t address_len)
return -1;
}
- ip_string = ip_to_string(inet_addr->sin_addr);
+ ip_string = ip_to_string(inet_addr->sin_addr.s_addr);
port = big_endian_word(inet_addr->sin_port);
if (asprintf(&path, "tcpip:/%s:%d", ip_string, port) < 0)
{
--
1.6.0.2