From b5d9e56cfbced83df651a09929295edfecb34025 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sat, 5 Apr 2008 21:08:48 +0200 Subject: [PATCH] Fix SET_SS_LEN so that it also works correctly outside libratbox. Use RB_SOCKADDR_HAS_SA_LEN instead of SOCKADDR_IN_HAS_LEN which is only defined inside libratbox. This fixes creating own sockaddr structs in other programs using SET_SS_LEN, then passing them to libratbox, on 4.4BSD based systems. --- libratbox/include/ratbox_lib.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libratbox/include/ratbox_lib.h b/libratbox/include/ratbox_lib.h index 02ec7d5..04ab573 100644 --- a/libratbox/include/ratbox_lib.h +++ b/libratbox/include/ratbox_lib.h @@ -143,20 +143,20 @@ unsigned int geteuid(void); #define lrb_assert(expr) assert(expr) #endif -#ifdef SOCKADDR_IN_HAS_LEN +#ifdef RB_SOCKADDR_HAS_SA_LEN #define ss_len sa_len #endif #define GET_SS_FAMILY(x) (((struct sockaddr *)(x))->sa_family) -#ifdef SOCKADDR_IN_HAS_LEN +#ifdef RB_SOCKADDR_HAS_SA_LEN #define SET_SS_LEN(x, y) do { \ struct sockaddr *storage; \ storage = ((struct sockaddr *)(x));\ storage->sa_len = (y); \ } while (0) #define GET_SS_LEN(x) (((struct sockaddr *)(x))->sa_len) -#else /* !SOCKADDR_IN_HAS_LEN */ +#else /* !RB_SOCKADDR_HAS_SA_LEN */ #define SET_SS_LEN(x, y) (((struct sockaddr *)(x))->sa_family = ((struct sockaddr *)(x))->sa_family) #ifdef RB_IPV6 #define GET_SS_LEN(x) (((struct sockaddr *)(x))->sa_family == AF_INET ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6))