From 6613bee90d0febc53f9f1fb1aa5960f8c79d68cb Mon Sep 17 00:00:00 2001 From: aland Date: Fri, 30 Jan 2004 21:01:40 +0000 Subject: [PATCH] Don't include libradius.h, radiusd.h includes it. Include netinet/in.h BEFORE radiusd.h, as radiusd.h includes missing.h, which tries to define INADDR_* Don't reference pthread functions if we're not building in threaded mode --- src/modules/rlm_ippool/rlm_ippool.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/modules/rlm_ippool/rlm_ippool.c b/src/modules/rlm_ippool/rlm_ippool.c index 8427f13..44ab708 100644 --- a/src/modules/rlm_ippool/rlm_ippool.c +++ b/src/modules/rlm_ippool/rlm_ippool.c @@ -48,20 +48,22 @@ #include "config.h" #include "autoconf.h" -#include "libradius.h" #include #include #include #include +#ifdef HAVE_NETINET_IN_H +#include +#endif + #include "radiusd.h" #include "modules.h" #include "conffile.h" #include #include -#include #ifdef NEEDS_GDBM_SYNC # define GDBM_SYNCOPT GDBM_SYNC @@ -97,9 +99,21 @@ typedef struct rlm_ippool_t { int override; GDBM_FILE gdbm; GDBM_FILE ip; +#ifdef HAVE_PTHREAD_H pthread_mutex_t op_mutex; +#endif } rlm_ippool_t; +#ifndef HAVE_PTHREAD_H +/* + * This is easier than ifdef's throughout the code. + */ +#define pthread_mutex_init(_x, _y) +#define pthread_mutex_destroy(_x) +#define pthread_mutex_lock(_x) +#define pthread_mutex_unlock(_x) +#endif + typedef struct ippool_info { uint32_t ipaddr; char active; @@ -273,8 +287,8 @@ static int ippool_instantiate(CONF_SECTION *conf, void **instance) pool_name = cf_section_name2(conf); if (pool_name != NULL) data->name = strdup(pool_name); - pthread_mutex_init(&data->op_mutex, NULL); + pthread_mutex_init(&data->op_mutex, NULL); *instance = data; return 0; -- 2.1.4