]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Fix AIX build issues 693/head
authorGreg Hudson <ghudson@mit.edu>
Wed, 23 Aug 2017 21:45:02 +0000 (17:45 -0400)
committerGreg Hudson <ghudson@mit.edu>
Mon, 11 Sep 2017 15:21:35 +0000 (11:21 -0400)
In k5-platform.h, only test for SHARED and define the finalizer as
static if we don't expect linker options to be used for finalizers.
SHARED is not a robust test (it isn't defined when building objects
for shared libraries on AIX, OSF/1, or sometimes IRIX because they
don't use separate PIC objects), and as linker finalizer options are
only applied when shared libraries are created, we don't have to worry
about finalizers happening for static libraries.

In expand_path.c, remove the unnecessary structure tag from "struct
token" as it conflicts with <net/if_arp.h> on AIX.

In localaddr.c, initialize output parameters at the beginning of
get_ifreq_array().  Otherwise, gcc cannot be sure that they are always
set when get_ifreq_array() returns 0, because we use errno as a return
value in one case.  Also remove two unused variables.

Use socklen_t instead of int for socket lengths in sim_client.c and
sim_client.h.

Based on patches from Tony Reix.

ticket: 8608 (new)

src/appl/simple/client/sim_client.c
src/appl/simple/server/sim_server.c
src/include/k5-platform.h
src/lib/krb5/os/expand_path.c
src/lib/krb5/os/localaddr.c

index bd3c38c72aa7a5d7c344f4eca5d84aa3b4dcfc98..cda7d220c4068e76e2eae69bce63a6a5e31e385c 100644 (file)
@@ -62,7 +62,7 @@ int
 main(int argc, char *argv[])
 {
     int sock, i;
-    unsigned int len;
+    socklen_t len;
     int flags = 0;                      /* flags for sendto() */
     struct servent *serv;
     struct hostent *host;
index fce5a9c6fd6940d73c603903e05a0434244a7720..f09489c35d303aaf6a9e711a44e77da755a6b2f3 100644 (file)
@@ -33,6 +33,7 @@
  */
 
 #include "krb5.h"
+#include "port-sockets.h"
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
@@ -64,7 +65,7 @@ int
 main(int argc, char *argv[])
 {
     int sock, i;
-    unsigned int len;
+    socklen_t len;
     int flags = 0;                      /* for recvfrom() */
     int on = 1;
     struct servent *serv;
index d58710bab9fb22a0bcdc1d6c757c5961d2de2c2a..548c0486d567efeb7c159a2532c1861016f35cac 100644 (file)
@@ -361,16 +361,7 @@ typedef struct { int error; unsigned char did_run; } k5_init_t;
 
 
 
-#if !defined(SHARED) && !defined(_WIN32)
-
-/*
- * In this case, we just don't care about finalization.  The code will still
- * define the function, but we won't do anything with it.
- */
-# define MAKE_FINI_FUNCTION(NAME)               \
-        static void NAME(void) UNUSED
-
-#elif defined(USE_LINKER_FINI_OPTION) || defined(_WIN32)
+#if defined(USE_LINKER_FINI_OPTION) || defined(_WIN32)
 /* If we're told the linker option will be used, it doesn't really
    matter what compiler we're using.  Do it the same way
    regardless.  */
@@ -404,6 +395,15 @@ typedef struct { int error; unsigned char did_run; } k5_init_t;
 
 # endif
 
+#elif !defined(SHARED)
+
+/*
+ * In this case, we just don't care about finalization.  The code will still
+ * define the function, but we won't do anything with it.
+ */
+# define MAKE_FINI_FUNCTION(NAME)               \
+        static void NAME(void) UNUSED
+
 #elif defined(__GNUC__) && defined(DESTRUCTOR_ATTR_WORKS)
 /* If we're using gcc, if the C++ support works, the compiler should
    build executables and shared libraries that support the use of
index a8a14f4bb28b7e571f1e46ba39f4dcb2daa3fe84..61fb234594e6bcde852c1bc93d7d282e22d6680d 100644 (file)
@@ -351,7 +351,7 @@ expand_null(krb5_context context, PTYPE param, const char *postfix, char **ret)
     return 0;
 }
 
-static const struct token {
+static const struct {
     const char *tok;
     PTYPE param;
     const char *postfix;
index 21bc719d2c7eb9add06bb9fd81e2f84fd0fadfb8..58443f6e354ad2d38e903cc21bea5f822a700176 100644 (file)
@@ -862,6 +862,9 @@ get_ifreq_array(char **bufp, size_t *np, int s)
     int numifs = -1;
 #endif
 
+    *bufp = NULL;
+    *np = 0;
+
     /* At least on NetBSD, an ifreq can hold an IPv4 address, but
        isn't big enough for an IPv6 or ethernet address.  So add a
        little more space.  */
@@ -938,9 +941,9 @@ foreach_localaddr (/*@null@*/ void *data,
 #endif
 {
     struct ifreq *ifr, ifreq, *ifr2;
-    int s, code;
+    int s;
     char *buf = 0;
-    size_t size, n, i, j;
+    size_t n, i, j;
     int retval = 0;
 #ifdef LINUX_IPV6_HACK
     struct linux_ipv6_addr_list *linux_ipv6_addrs = get_linux_ipv6_addrs ();