freebsd-ports/sysutils/e2fsprogs/files/patch-lib__uuid__gen_uuid.c
Matthias Andree fd78a097fb Update to new upstream release 1.43.3.
ChangeLog: (also see the log for 1.43.2 that the port skipped!)
<http://e2fsprogs.sourceforge.net/e2fsprogs-release.html#1.43.3>

While here, refresh patches, and time-limit programs in self-test suite
to 60 s CPU time each, to avoid runaway processes from stalling the
self-tests for too long.

Still no joy on FreeBSD 11+ - the self-test results hint to massive data
loss, and more than 10 self-tests fail.
2016-09-10 18:00:53 +00:00

39 lines
880 B
C

--- lib/uuid/gen_uuid.c.orig 2016-09-02 04:17:32 UTC
+++ lib/uuid/gen_uuid.c
@@ -92,6 +92,7 @@
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
+#include <ifaddrs.h>
#include "uuidP.h"
#include "uuidd.h"
@@ -301,6 +302,28 @@ static int get_node_id(unsigned char *no
}
}
close(sd);
+#else
+ struct ifaddrs *ifaddrsp, *ifaddrp;
+ unsigned char *a;
+
+ if (getifaddrs(&ifaddrsp) < 0)
+ return -1;
+ for (ifaddrp = ifaddrsp; ifaddrp != NULL; ifaddrp = ifaddrp->ifa_next)
+ {
+ if (ifaddrp->ifa_addr == NULL)
+ continue;
+ if (ifaddrp->ifa_addr->sa_family != AF_LINK)
+ continue;
+ a = LLADDR((struct sockaddr_dl *)ifaddrp->ifa_addr);
+ if (!a[0] && !a[1] && !a[2] && !a[3] && !a[4] && !a[5])
+ continue;
+ if (node_id) {
+ memcpy(node_id, a, 6);
+ freeifaddrs(ifaddrsp);
+ return 1;
+ }
+ }
+ freeifaddrs(ifaddrsp);
#endif
return 0;
}