[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

library/1910: potential warnings/errors in getifaddrs.c




>Number:         1910
>Category:       library
>Synopsis:       errors/warnings in unused code in getifaddrs.c
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jun 30 13:40:02 MDT 2001
>Last-Modified:
>Originator:     Karl-Andre' Skevik
>Organization:
Inferno Nettverk A/S, Oslo, Norway; http://www.inet.no
>Release:        current
>Environment:
	
	System      : OpenBSD 2.8
	Architecture: OpenBSD.i386
	Machine     : i386
>Description:
getifaddrs.c won't compile if NET_RT_IFLIST isn't defined.
This is probably not very exciting since that part of the
code doesn't appear to be used, but it is in the tree.
>How-To-Repeat:
undefine NET_RT_IFLIST in getifaddrs.c and attempt to compile it	
>Fix:
Index: getifaddrs.c
===================================================================
RCS file: /cvs/./src/lib/libc/net/getifaddrs.c,v
retrieving revision 1.4
diff -c -r1.4 getifaddrs.c
*** getifaddrs.c        2001/06/27 00:58:55     1.4
--- getifaddrs.c        2001/06/30 19:22:00
***************
*** 43,48 ****
--- 43,49 ----
  #include <ifaddrs.h>
  #include <stdlib.h>
  #include <string.h>
+ #include <unistd.h>
  
  #if !defined(AF_LINK)
  #define       SA_LEN(sa)      sizeof(struct sockaddr)
***************
*** 97,113 ****
        struct ifa_msghdr *ifam;
        struct sockaddr_dl *dl;
        struct sockaddr *sa;
-       struct ifaddrs *ifa, *ift;
        u_short index = 0;
  #else /* NET_RT_IFLIST */
        char buf[1024];
!       int m, sock;
        struct ifconf ifc;
        struct ifreq *ifr;
        struct ifreq *lifr;
  #endif        /* NET_RT_IFLIST */
        int i;
-       size_t len, alen;
        char *data;
        char *names;
  
--- 98,114 ----
        struct ifa_msghdr *ifam;
        struct sockaddr_dl *dl;
        struct sockaddr *sa;
        u_short index = 0;
+       size_t len, alen;
  #else /* NET_RT_IFLIST */
        char buf[1024];
!       int sock;
        struct ifconf ifc;
        struct ifreq *ifr;
        struct ifreq *lifr;
  #endif        /* NET_RT_IFLIST */
+       struct ifaddrs *ifa, *ift;
        int i;
        char *data;
        char *names;

>Audit-Trail:
>Unformatted: