diff options
-rw-r--r-- | lib/sockopt.c | 20 | ||||
-rw-r--r-- | tests/test-symtab.c | 18 |
2 files changed, 28 insertions, 10 deletions
diff --git a/lib/sockopt.c b/lib/sockopt.c index c7a8db5f..b1e47c99 100644 --- a/lib/sockopt.c +++ b/lib/sockopt.c @@ -275,12 +275,22 @@ setsockopt_minttl (int sock_fd, int ttl) #ifdef HAVE_IPV6 -# ifdef GNU_LINUX - /* The #include to bring in IPV6_MINHOPCOUNT is buried more or less as - * deep as we can get it, because it also redefines a number of things - * that we do not want redefined. +# ifndef IPV6_MINHOPCOUNT + /* IPV6_MINHOPCOUNT ought to find its way into in.h at some point. + * + * For GNU_LINUX it is currently found in linux/in6.h. Unfortunately, that + * seems to redefine a number of things which are defined in in.h... so, + * the #include to bring in IPV6_MINHOPCOUNT is buried more or less as + * deep as we can get it. + * + * However, this trick does not always work... for example, if linux/in6.h + * redefines "extern const struct in6_addr in6addr_any" !! Do not know + * any way to fix that, so -DNO_LINUX_IN6_H will turn this off -- and will + * have to live without IPV6_MINHOPCOUNT pro tem. */ - #include <linux/in6.h> +# if defined(GNU_LINUX) && !defined(NO_LINUX_IN6_H) + #include <linux/in6.h> +# endif # endif enum diff --git a/tests/test-symtab.c b/tests/test-symtab.c index a4b0bcf2..2076a2bd 100644 --- a/tests/test-symtab.c +++ b/tests/test-symtab.c @@ -50,6 +50,7 @@ test_symbol_table_init_new(void) symbol sym = NULL; symbol sym2 = NULL; void * old_value = NULL; + const void* get_name ; printf("test_symbol_table_init_new\n"); table = symbol_table_init_new(table, NULL, 0, 0, NULL, NULL); @@ -63,7 +64,8 @@ test_symbol_table_init_new(void) sym = symbol_lookup(table, name, add); symbol_set_value(sym, value); assert_true(sym != NULL, "sym == NULL"); - assert_true(strcmp(symbol_get_name(sym), name) == 0, + get_name = symbol_get_name(sym) ; + assert_true(strcmp(get_name, name) == 0, "strcmp(symbol_get_name(sym), name) != 0"); /* find */ @@ -98,11 +100,14 @@ test_symbol_table_lookup(void) /* add */ for (i = 0; i < len; ++i) { + const void* get_name ; + sprintf(buf, "%d-name", i); sym = symbol_lookup(table, buf, add); assert_true(sym != NULL, "add: sym == NULL"); - assert_true(strcmp(symbol_get_name(sym), buf) == 0, - "strcmp(symbol_get_name(sym), buf) != 0"); + get_name = symbol_get_name(sym) ; + assert_true(strcmp(get_name, buf) == 0, + "strcmp(symbol_get_name(sym), buf) != 0"); sprintf(buf, "%d-value", i); value = strdup(buf); @@ -114,11 +119,14 @@ test_symbol_table_lookup(void) /* find */ for (i = 0; i < len; ++i) { + const void* get_name ; + sprintf(buf, "%d-name", i); sym = symbol_lookup(table, buf, no_add); assert_true(sym != NULL, "find: sym == NULL"); - assert_true(strcmp(symbol_get_name(sym), buf) == 0, - "strcmp(symbol_get_name(sym), buf) != 0"); + get_name = symbol_get_name(sym) ; + assert_true(strcmp(get_name, buf) == 0, + "strcmp(symbol_get_name(sym), buf) != 0"); sprintf(buf, "%d-value", i); assert_true(strcmp(symbol_get_value(sym), buf) == 0, |