45 lines
1012 B
Plaintext
45 lines
1012 B
Plaintext
$NetBSD: patch-ao,v 1.1 2014/06/11 11:03:56 hauke Exp $
|
|
|
|
--- libatalk/util/getiface.c.orig 2005-01-31 14:50:54.000000000 -0500
|
|
+++ libatalk/util/getiface.c 2008-04-05 21:32:56.000000000 -0400
|
|
@@ -16,6 +16,10 @@
|
|
#include <stdint.h>
|
|
#endif
|
|
|
|
+#ifdef HAVE_GETIFADDRS
|
|
+#include <ifaddrs.h>
|
|
+#endif
|
|
+
|
|
#include <sys/types.h>
|
|
#include <sys/socket.h>
|
|
#include <sys/ioctl.h>
|
|
@@ -74,6 +78,28 @@
|
|
*list = new;
|
|
return i;
|
|
|
|
+#elif defined(HAVE_GETIFADDRS)
|
|
+ struct ifaddrs *ifa, *a;
|
|
+ int i;
|
|
+ char **new;
|
|
+
|
|
+ if (!list)
|
|
+ return 0;
|
|
+ if (getifaddrs(&ifa) == -1)
|
|
+ return 0;
|
|
+ for (i = 0, a = ifa; a != NULL; a = a->ifa_next, i++)
|
|
+ continue;
|
|
+ new = malloc((i + 1) * sizeof(char *));
|
|
+ if (new == NULL) {
|
|
+ freeifaddrs(ifa);
|
|
+ return 0;
|
|
+ }
|
|
+ for (i = 0, a = ifa; a != NULL; a = a->ifa_next)
|
|
+ if (addname(new, &i, a->ifa_name) < 0)
|
|
+ break;
|
|
+ freeifaddrs(ifa);
|
|
+ *list = new;
|
|
+ return i;
|
|
#else
|
|
struct ifconf ifc;
|
|
struct ifreq ifrs[ 64 ], *ifr, *nextifr;
|