More fixes for -Werror
authoraland <aland>
Mon, 26 Nov 2007 12:46:18 +0000 (12:46 +0000)
committeraland <aland>
Mon, 26 Nov 2007 12:46:18 +0000 (12:46 +0000)
src/include/missing.h
src/lib/getaddrinfo.c
src/lib/misc.c
src/lib/missing.c

index 75a8454..42f05a5 100644 (file)
@@ -112,7 +112,7 @@ struct tm *localtime_r(const time_t *l_clock, struct tm *result);
 char *ctime_r(const time_t *l_clock, char *l_buf);
 #endif
 
-#ifdef NEED_DECLARATION_CRYPT
+#if defined(NEED_DECLARATION_CRYPT) || !defined(HAVE_CRYPT)
 char *crypt(char *key, char *salt);
 #endif
 
@@ -124,9 +124,9 @@ int strncasecmp(char *s1, char *s2, int n);
 int strcasecmp(char *s1, char *s2);
 #endif
 
-#ifdef NEED_DECLARATION_INET_ATON
+#if defined(NEED_DECLARATION_INET_ATON) || !defined(HAVE_INET_ATON)
 struct in_addr;
-int inet_aton(char *cp, struct in_addr *inp);
+int inet_aton(const char *cp, struct in_addr *inp);
 #endif
 
 #ifndef HAVE_SETLINEBUF
@@ -322,7 +322,7 @@ extern int getaddrinfo (const char *__name,
 extern void freeaddrinfo (struct addrinfo *__ai);
 
 /* Convert error return from getaddrinfo() to a string.  */
-extern char *gai_strerror (int __ecode);
+extern const char *gai_strerror (int __ecode);
 #endif
 
 /* Translate a socket address to a location and service name. */
index 4ba5a40..f648dd8 100644 (file)
@@ -68,8 +68,8 @@ static pthread_mutex_t fr_hodtbyaddr_mutex;
  */
 #if defined(LOCAL_GETHOSTBYNAMER) || defined(LOCAL_GETHOSTBYADDRR)
 #define BUFFER_OVERFLOW 255
-int copy_hostent(struct hostent *from, struct hostent *to,
-           char *buffer, int buflen, int *error)
+static int copy_hostent(struct hostent *from, struct hostent *to,
+                       char *buffer, int buflen, int *error)
 {
     int i, len;
     char *ptr = buffer;
@@ -221,7 +221,7 @@ malloc_ai(int port, u_long addr, int socktype, int proto)
     }
 }
 
-char *
+const char *
 gai_strerror(int ecode)
 {
     switch (ecode) {
@@ -288,7 +288,7 @@ getaddrinfo(const char *hostname, const char *servname,
             port = htons(atoi(servname));
         else {
             struct servent *se;
-            char *pe_proto;
+            const char *pe_proto;
 
             switch (socktype) {
             case SOCK_DGRAM:
@@ -377,7 +377,7 @@ getnameinfo(const struct sockaddr *sa, socklen_t salen,
                char *serv, size_t servlen,
                unsigned int flags)
 {
-    struct sockaddr_in *sin = (struct sockaddr_in *)sa;
+    const struct sockaddr_in *sin = (const struct sockaddr_in *)sa;
     struct hostent *hp;
     struct hostent result;
     char tmpserv[16];
@@ -406,24 +406,24 @@ getnameinfo(const struct sockaddr *sa, socklen_t salen,
         /*  Reverse DNS lookup required */
 #ifdef GETHOSTBYADDRRSTYLE
 #if GETHOSTBYADDRRSTYLE == SYSVSTYLE
-            hp = gethostbyaddr_r((char *)&sin->sin_addr,
-                               sizeof(struct in_addr), AF_INET,
+            hp = gethostbyaddr_r((const char *)&sin->sin_addr,
+                               salen, AF_INET,
                               &result, buffer, sizeof(buffer), &error);
 #elif GETHOSTBYADDRRSTYLE == GNUSTYLE
-            if (gethostbyaddr_r((char *)&sin->sin_addr,
-                               sizeof(struct in_addr), AF_INET,
+            if (gethostbyaddr_r((const char *)&sin->sin_addr,
+                               salen, AF_INET,
                                    &result, buffer, sizeof(buffer),
                                    &hp, &error) != 0) {
                        hp = NULL;
             }
 #else
-            hp = gethostbyaddr_r((char *)&sin->sin_addr,
-                               sizeof(struct in_addr), AF_INET,
+            hp = gethostbyaddr_r((const char *)&sin->sin_addr,
+                               salen, AF_INET,
                               &result, buffer, sizeof(buffer), &error);
 #endif
 #else
-            hp = gethostbyaddr_r((char *)&sin->sin_addr,
-                               sizeof(struct in_addr), AF_INET,
+            hp = gethostbyaddr_r((const char *)&sin->sin_addr,
+                               salen, AF_INET,
                               &result, buffer, sizeof(buffer), &error);
 #endif
             if (hp)
index 4722d5f..281111b 100644 (file)
@@ -230,6 +230,7 @@ static int inet_pton4(const char *src, struct in_addr *dst)
 }
 
 
+#ifdef HAVE_STRUCT_SOCKADDR_IN6
 /* int
  * inet_pton6(src, dst)
  *     convert presentation level address to network order binary form.
@@ -293,7 +294,7 @@ inet_pton6(const char *src, unsigned char *dst)
                        continue;
                }
                if (ch == '.' && ((tp + INADDRSZ) <= endp) &&
-                   inet_pton4(curtok, tp) > 0) {
+                   inet_pton4(curtok, (struct in_addr *) tp) > 0) {
                        tp += INADDRSZ;
                        saw_xdigit = 0;
                        break;  /* '\0' was seen by inet_pton4(). */
@@ -326,6 +327,7 @@ inet_pton6(const char *src, unsigned char *dst)
        memcpy(dst, tmp, IN6ADDRSZ);
        return (1);
 }
+#endif
 
 /*
  *     Utility function, so that the rest of the server doesn't
index 9c0c580..17c1336 100644 (file)
@@ -29,10 +29,10 @@ RCSID("$Id$")
 #include       <ctype.h>
 
 #ifndef HAVE_CRYPT
-char *crypt(char *key, char *salt)
+char *crypt(UNUSED char *key, char *salt)
 {
        /*log(L_ERR, "crypt() called but not implemented");*/
-       return "____fnord____";
+       return salt;
 }
 #endif
 
@@ -80,7 +80,7 @@ int strcasecmp(char *s1, char *s2)
 #endif
 
 #ifndef HAVE_INET_ATON
-int inet_aton(char *cp, struct in_addr *inp)
+int inet_aton(const char *cp, struct in_addr *inp)
 {
        int     a1, a2, a3, a4;