diff --git a/main/musl/0004-e94d0692-to-83c98aac.patch b/main/musl/0004-e94d0692-to-83c98aac.patch
new file mode 100644
index 0000000000000000000000000000000000000000..88cf625fc877a89fdba24e65033795e3c46958b9
--- /dev/null
+++ b/main/musl/0004-e94d0692-to-83c98aac.patch
@@ -0,0 +1,59 @@
+diff --git a/src/internal/syscall.h b/src/internal/syscall.h
+index 88fc89c..dcfae00 100644
+--- a/src/internal/syscall.h
++++ b/src/internal/syscall.h
+@@ -10,7 +10,7 @@ typedef long syscall_arg_t;
+ #endif
+ 
+ #if defined(__PIC__) && (100*__GNUC__+__GNUC_MINOR__ >= 303)
+-__attribute__((visibility("protected")))
++__attribute__((visibility("hidden")))
+ #endif
+ long __syscall_ret(unsigned long), __syscall(syscall_arg_t, ...),
+ 	__syscall_cp(syscall_arg_t, syscall_arg_t, syscall_arg_t, syscall_arg_t,
+diff --git a/src/math/modfl.c b/src/math/modfl.c
+index f736bba..4b03a4b 100644
+--- a/src/math/modfl.c
++++ b/src/math/modfl.c
+@@ -3,7 +3,12 @@
+ #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
+ long double modfl(long double x, long double *iptr)
+ {
+-	return modf(x, (double *)iptr);
++	double d;
++	long double r;
++
++	r = modf(x, &d);
++	*iptr = d;
++	return r;
+ }
+ #elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384
+ #if LDBL_MANT_DIG == 64
+diff --git a/src/math/sincosl.c b/src/math/sincosl.c
+index 2c60080..d3ac1c4 100644
+--- a/src/math/sincosl.c
++++ b/src/math/sincosl.c
+@@ -4,7 +4,10 @@
+ #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
+ void sincosl(long double x, long double *sin, long double *cos)
+ {
+-	sincos(x, (double *)sin, (double *)cos);
++	double sind, cosd;
++	sincos(x, &sind, &cosd);
++	*sin = sind;
++	*cos = cosd;
+ }
+ #elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384
+ void sincosl(long double x, long double *sin, long double *cos)
+diff --git a/src/string/memmem.c b/src/string/memmem.c
+index 5211d75..a5a249f 100644
+--- a/src/string/memmem.c
++++ b/src/string/memmem.c
+@@ -139,6 +139,7 @@ void *memmem(const void *h0, size_t k, const void *n0, size_t l)
+ 	/* Use faster algorithms for short needles */
+ 	h = memchr(h0, *n, k);
+ 	if (!h || l==1) return (void *)h;
++	k -= h - (const unsigned char *)h0;
+ 	if (l==2) return twobyte_memmem(h, k, n);
+ 	if (l==3) return threebyte_memmem(h, k, n);
+ 	if (l==4) return fourbyte_memmem(h, k, n);
diff --git a/main/musl/1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch b/main/musl/1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch
index f740e20672e4fe2a09bb22173e5e7168246a80c4..f8df5dc3997d565122b9b2d984dc62dc610817a1 100644
--- a/main/musl/1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch
+++ b/main/musl/1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch
@@ -1,85 +1,55 @@
-From 274b49ab1c7296fc13076b3ed8ca30050487a343 Mon Sep 17 00:00:00 2001
+From c3d5cce5c550896fd8e9cf856f66f5f264b49ef7 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
 Date: Tue, 8 Apr 2014 14:03:16 +0000
 Subject: [PATCH] reimplement if_nameindex and getifaddrs using netlink
 
 ---
- src/network/__netlink.c    |  68 ++++++++++
- src/network/__netlink.h    | 143 ++++++++++++++++++++
- src/network/getifaddrs.c   | 322 ++++++++++++++++++++++++---------------------
- src/network/if_nameindex.c | 105 +++++++++------
- 4 files changed, 451 insertions(+), 187 deletions(-)
+ src/network/__netlink.c    |  38 ++++++
+ src/network/__netlink.h    |  99 ++++++++++++++
+ src/network/getifaddrs.c   | 325 +++++++++++++++++++++++++--------------------
+ src/network/if_nameindex.c | 107 +++++++++------
+ 4 files changed, 382 insertions(+), 187 deletions(-)
  create mode 100644 src/network/__netlink.c
  create mode 100644 src/network/__netlink.h
 
 diff --git a/src/network/__netlink.c b/src/network/__netlink.c
 new file mode 100644
-index 0000000..d0c9fab
+index 0000000..e75f374
 --- /dev/null
 +++ b/src/network/__netlink.c
-@@ -0,0 +1,68 @@
-+#define _GNU_SOURCE
+@@ -0,0 +1,38 @@
 +#include <errno.h>
 +#include <string.h>
-+#include <stdlib.h>
-+#include <unistd.h>
 +#include <sys/socket.h>
-+#include <sys/param.h>
 +#include "__netlink.h"
 +
-+struct __netlink_handle {
-+	int fd;
-+	unsigned int seq;
-+	size_t bufsize;
-+};
-+
-+struct __netlink_handle *__netlink_open(int type)
-+{
-+	struct __netlink_handle *nh;
-+	int bufsize = getpagesize();
-+	/* required buffer size is MIN(8192,pagesize)-sizeof(struct skb_shared_info)
-+	 * the estimate for skb_shared_info size is conservative, but gives enough
-+	 * space to fit struct __netlink_handle including malloc overhead in one page . */
-+	if (bufsize > 8192) bufsize = 8192;
-+	bufsize -= 128;
-+	nh = malloc(sizeof(struct __netlink_handle) + bufsize);
-+	if (!nh) return 0;
-+	nh->fd = socket(PF_NETLINK, SOCK_RAW|SOCK_CLOEXEC, type);
-+	if (nh->fd < 0) { free(nh); return 0; }
-+	nh->seq = 1;
-+	nh->bufsize = bufsize;
-+	return nh;
-+}
-+
-+void __netlink_close(struct __netlink_handle *nh)
-+{
-+	close(nh->fd);
-+	free(nh);
-+}
-+
-+int __netlink_enumerate(struct __netlink_handle *nh, int type, int (*cb)(void *ctx, struct nlmsghdr *h), void *ctx)
++int __netlink_enumerate(int fd, unsigned int seq, int type, int af,
++	int (*cb)(void *ctx, struct nlmsghdr *h), void *ctx)
 +{
 +	struct nlmsghdr *h;
-+	void *buf = (void*)(nh+1);
-+	struct {
-+		struct nlmsghdr nlh;
-+		struct rtgenmsg g;
-+	} *req = buf;
++	union {
++		uint8_t buf[8192];
++		struct {
++			struct nlmsghdr nlh;
++			struct rtgenmsg g;
++		} req;
++		struct nlmsghdr reply;
++	} u;
 +	int r, ret = 0;
 +
-+	memset(req, 0, NETLINK_ALIGN(sizeof(*req)));
-+	req->nlh.nlmsg_len = sizeof(*req);
-+	req->nlh.nlmsg_type = type;
-+	req->nlh.nlmsg_flags = NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST;
-+	req->nlh.nlmsg_seq = nh->seq++;
-+	req->g.rtgen_family = AF_UNSPEC;
-+	r = send(nh->fd, req, sizeof(*req), 0);
++	memset(&u.req, 0, sizeof(u.req));
++	u.req.nlh.nlmsg_len = sizeof(u.req);
++	u.req.nlh.nlmsg_type = type;
++	u.req.nlh.nlmsg_flags = NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST;
++	u.req.nlh.nlmsg_seq = seq;
++	u.req.g.rtgen_family = af;
++	r = send(fd, &u.req, sizeof(u.req), 0);
 +	if (r < 0) return r;
 +
 +	while (1) {
-+		r = recv(nh->fd, buf, nh->bufsize, MSG_DONTWAIT);
++		r = recv(fd, u.buf, sizeof(u.buf), MSG_DONTWAIT);
 +		if (r <= 0) return -1;
-+		for (h = (struct nlmsghdr*) buf; NLMSG_OK(h, (void*)((uint8_t*)buf+r)); h = NLMSG_NEXT(h)) {
++		for (h = &u.reply; NLMSG_OK(h, (void*)&u.buf[r]); h = NLMSG_NEXT(h)) {
 +			if (h->nlmsg_type == NLMSG_DONE) return ret;
 +			if (h->nlmsg_type == NLMSG_ERROR) return -1;
 +			if (!ret) ret = cb(ctx, h);
@@ -88,10 +58,10 @@ index 0000000..d0c9fab
 +}
 diff --git a/src/network/__netlink.h b/src/network/__netlink.h
 new file mode 100644
-index 0000000..94728f3
+index 0000000..40b12a2
 --- /dev/null
 +++ b/src/network/__netlink.h
-@@ -0,0 +1,143 @@
+@@ -0,0 +1,99 @@
 +#include <stdint.h>
 +
 +/* linux/netlink.h */
@@ -147,44 +117,10 @@ index 0000000..94728f3
 +
 +/* linux/if_link.h */
 +
-+enum {
-+	IFLA_UNSPEC,
-+	IFLA_ADDRESS,
-+	IFLA_BROADCAST,
-+	IFLA_IFNAME,
-+	IFLA_MTU,
-+	IFLA_LINK,
-+	IFLA_QDISC,
-+	IFLA_STATS,
-+	IFLA_COST,
-+	IFLA_PRIORITY,
-+	IFLA_MASTER,
-+	IFLA_WIRELESS,
-+	IFLA_PROTINFO,
-+	IFLA_TXQLEN,
-+	IFLA_MAP,
-+	IFLA_WEIGHT,
-+	IFLA_OPERSTATE,
-+	IFLA_LINKMODE,
-+	IFLA_LINKINFO,
-+	IFLA_NET_NS_PID,
-+	IFLA_IFALIAS,
-+	IFLA_NUM_VF,
-+	IFLA_VFINFO_LIST,
-+	IFLA_STATS64,
-+	IFLA_VF_PORTS,
-+	IFLA_PORT_SELF,
-+	IFLA_AF_SPEC,
-+	IFLA_GROUP,
-+	IFLA_NET_NS_FD,
-+	IFLA_EXT_MASK,
-+	IFLA_PROMISCUITY,
-+	IFLA_NUM_TX_QUEUES,
-+	IFLA_NUM_RX_QUEUES,
-+	IFLA_CARRIER,
-+	IFLA_PHYS_PORT_ID,
-+	__IFLA_MAX
-+};
++#define IFLA_ADDRESS	1
++#define IFLA_BROADCAST	2
++#define IFLA_IFNAME	3
++#define IFLA_STATS	7
 +
 +/* linux/if_addr.h */
 +
@@ -196,50 +132,40 @@ index 0000000..94728f3
 +	uint32_t	ifa_index;
 +};
 +
-+enum {
-+	IFA_UNSPEC,
-+	IFA_ADDRESS,
-+	IFA_LOCAL,
-+	IFA_LABEL,
-+	IFA_BROADCAST,
-+	IFA_ANYCAST,
-+	IFA_CACHEINFO,
-+	IFA_MULTICAST,
-+	__IFA_MAX
-+};
++#define IFA_ADDRESS	1
++#define IFA_LOCAL	2
++#define IFA_LABEL	3
++#define IFA_BROADCAST	4
 +
 +/* musl */
 +
 +#define NETLINK_ALIGN(len)	(((len)+3) & ~3)
-+#define NLMSG_DATA(nlh)		((void*)((char*)(nlh)+NETLINK_ALIGN(sizeof(struct nlmsghdr))))
-+#define NLMSG_DATALEN(nlh)	((nlh)->nlmsg_len-NETLINK_ALIGN(sizeof(struct nlmsghdr)))
++#define NLMSG_DATA(nlh)		((void*)((char*)(nlh)+sizeof(struct nlmsghdr)))
++#define NLMSG_DATALEN(nlh)	((nlh)->nlmsg_len-sizeof(struct nlmsghdr))
 +#define NLMSG_DATAEND(nlh)	((char*)(nlh)+(nlh)->nlmsg_len)
 +#define NLMSG_NEXT(nlh)		(struct nlmsghdr*)((char*)(nlh)+NETLINK_ALIGN((nlh)->nlmsg_len))
 +#define NLMSG_OK(nlh,end)	(NLMSG_DATA(nlh) <= (end) && \
 +				 (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \
 +				 (void*)NLMSG_NEXT(nlh) <= (end))
 +
-+#define RTA_DATA(rta)		((void*)((char*)(rta)+NETLINK_ALIGN(sizeof(struct rtattr))))
-+#define RTA_DATALEN(rta)	((rta)->rta_len-NETLINK_ALIGN(sizeof(struct rtattr)))
++#define RTA_DATA(rta)		((void*)((char*)(rta)+sizeof(struct rtattr)))
++#define RTA_DATALEN(rta)	((rta)->rta_len-sizeof(struct rtattr))
 +#define RTA_DATAEND(rta)	((char*)(rta)+(rta)->rta_len)
 +#define RTA_NEXT(rta)		(struct rtattr*)((char*)(rta)+NETLINK_ALIGN((rta)->rta_len))
 +#define RTA_OK(rta,end)		(RTA_DATA(rta) <= (void*)(end) && \
 +				 (rta)->rta_len >= sizeof(struct rtattr) && \
 +				 (void*)RTA_NEXT(rta) <= (void*)(end))
 +
-+#define NLMSG_RTA(nlh,len)	((void*)((char*)(nlh)+NETLINK_ALIGN(sizeof(struct nlmsghdr))+NETLINK_ALIGN(len)))
++#define NLMSG_RTA(nlh,len)	((void*)((char*)(nlh)+sizeof(struct nlmsghdr)+NETLINK_ALIGN(len)))
 +#define NLMSG_RTAOK(rta,nlh)	RTA_OK(rta,NLMSG_DATAEND(nlh))
 +
-+struct __netlink_handle;
-+
-+struct __netlink_handle *__netlink_open(int type);
-+void __netlink_close(struct __netlink_handle *h);
-+int __netlink_enumerate(struct __netlink_handle *h, int type, int (*cb)(void *ctx, struct nlmsghdr *h), void *ctx);
++int __netlink_enumerate(int fd, unsigned int seq, int type, int af,
++	int (*cb)(void *ctx, struct nlmsghdr *h), void *ctx);
 diff --git a/src/network/getifaddrs.c b/src/network/getifaddrs.c
-index 5a94cc7..5b1ebe7 100644
+index 5a94cc7..9d4bd5b 100644
 --- a/src/network/getifaddrs.c
 +++ b/src/network/getifaddrs.c
-@@ -1,181 +1,209 @@
+@@ -1,181 +1,212 @@
 -/* (C) 2013 John Spencer. released under musl's standard MIT license. */
 -#undef _GNU_SOURCE
  #define _GNU_SOURCE
@@ -257,14 +183,16 @@ index 5a94cc7..5b1ebe7 100644
 -#include <sys/ioctl.h>
 -#include <sys/socket.h>
 +#include <ifaddrs.h>
++#include <syscall.h>
 +#include <net/if.h>
 +#include "__netlink.h"
  
 -typedef union {
 -	struct sockaddr_in6 v6;
-+/* getifaddrs() uses PF_PACKET to relay hardware addresses.
-+ * But Infiniband socket address length is longer, so use this hack
-+ * (like glibc) to return it anyway. */
++/* getifaddrs() reports hardware addresses with PF_PACKET that implies
++ * struct sockaddr_ll.  But e.g. Infiniband socket address length is
++ * longer than sockaddr_ll.ssl_addr[8] can hold. Use this hack struct
++ * to extend ssl_addr - callers should be able to still use it. */
 +struct sockaddr_ll_hack {
 +	unsigned short sll_family, sll_protocol;
 +	int sll_ifindex;
@@ -336,10 +264,21 @@ index 5a94cc7..5b1ebe7 100644
 +	if (!ctx->first) ctx->first = add;
 +	if (ctx->last) ctx->last->ifa.ifa_next = &add->ifa;
 +	ctx->last = add;
++}
++
++static struct sockaddr* copy_lladdr(union sockany *sa, struct rtattr *rta, struct ifinfomsg *ifi)
++{
++	if (RTA_DATALEN(rta) > sizeof(sa->ll.sll_addr)) return 0;
++	sa->ll.sll_family = AF_PACKET;
++	sa->ll.sll_ifindex = ifi->ifi_index;
++	sa->ll.sll_hatype = ifi->ifi_type;
++	sa->ll.sll_halen = RTA_DATALEN(rta);
++	memcpy(sa->ll.sll_addr, RTA_DATA(rta), RTA_DATALEN(rta));
++	return &sa->sa;
  }
  
 -static void ipv6netmask(unsigned prefix_length, struct sockaddr_in6 *sa)
-+static struct sockaddr* copy_lladdr(union sockany *sa, struct rtattr *rta, struct ifinfomsg *ifi)
++static uint8_t *sockany_addr(int af, union sockany *sa, int *len)
  {
 -	unsigned char* hb = sa->sin6_addr.s6_addr;
 -	unsigned onebytes = prefix_length / 8;
@@ -351,17 +290,6 @@ index 5a94cc7..5b1ebe7 100644
 -		unsigned char x = -1;
 -		x <<= 8 - bits;
 -		hb[onebytes] = x;
-+	if (RTA_DATALEN(rta) > sizeof(sa->ll.sll_addr)) return 0;
-+	sa->ll.sll_family = AF_PACKET;
-+	sa->ll.sll_ifindex = ifi->ifi_index;
-+	sa->ll.sll_hatype = ifi->ifi_type;
-+	sa->ll.sll_halen = RTA_DATALEN(rta);
-+	memcpy(sa->ll.sll_addr, RTA_DATA(rta), RTA_DATALEN(rta));
-+	return &sa->sa;
-+}
-+
-+static uint8_t *sockany_addr(int af, union sockany *sa, int *len)
-+{
 +	switch (af) {
 +	case AF_INET: *len = 4; return (uint8_t*) &sa->v4.sin_addr;
 +	case AF_INET6: *len = 16; return (uint8_t*) &sa->v6.sin6_addr;
@@ -583,24 +511,25 @@ index 5a94cc7..5b1ebe7 100644
 +int getifaddrs(struct ifaddrs **ifap)
 +{
 +	struct ifaddrs_ctx _ctx, *ctx = &_ctx;
-+	struct __netlink_handle *nh;
-+	int r = 0;
++	int r = 0, fd;
++
++	fd = socket(PF_NETLINK, SOCK_RAW|SOCK_CLOEXEC, NETLINK_ROUTE);
++	if (fd < 0) return -1;
 +
-+	nh = __netlink_open(NETLINK_ROUTE);
-+	if (!nh) return -1;
 +	memset(ctx, 0, sizeof(*ctx));
-+	if (__netlink_enumerate(nh, RTM_GETLINK, __handle_link, ctx)) r = -1;
-+	if (__netlink_enumerate(nh, RTM_GETADDR, __handle_addr, ctx)) r = -1;
-+	__netlink_close(nh);
++	if (__netlink_enumerate(fd, 1, RTM_GETLINK, AF_UNSPEC, __handle_link, ctx)) r = -1;
++	if (__netlink_enumerate(fd, 1, RTM_GETADDR, AF_UNSPEC, __handle_addr, ctx)) r = -1;
++	__syscall(SYS_close,fd);
++
 +	if (r == 0) *ifap = &ctx->first->ifa;
 +	else freeifaddrs(&ctx->first->ifa);
 +	return r;
 +}
 diff --git a/src/network/if_nameindex.c b/src/network/if_nameindex.c
-index 53b80b2..d4e8b2d 100644
+index 53b80b2..cb5587c 100644
 --- a/src/network/if_nameindex.c
 +++ b/src/network/if_nameindex.c
-@@ -1,55 +1,80 @@
+@@ -1,55 +1,82 @@
  #define _GNU_SOURCE
  #include <net/if.h>
 -#include <stdlib.h>
@@ -611,6 +540,7 @@ index 53b80b2..d4e8b2d 100644
 +#include <unistd.h>
 +#include <stdlib.h>
 +#include <string.h>
++#include <syscall.h>
 +#include "__netlink.h"
 +
 +struct ifnamemap {
@@ -618,14 +548,14 @@ index 53b80b2..d4e8b2d 100644
 +	unsigned char namelen;
 +	char name[IFNAMSIZ];
 +};
- 
--static void *do_nameindex(int s, size_t n)
++
 +struct ifnameindexctx {
 +	unsigned int num;
 +	unsigned int str_bytes;
 +	struct ifnamemap *list;
 +};
-+
+ 
+-static void *do_nameindex(int s, size_t n)
 +static int __handle_link(void *pctx, struct nlmsghdr *h)
  {
 -	size_t i, len, k;
@@ -649,6 +579,10 @@ index 53b80b2..d4e8b2d 100644
 +	struct ifinfomsg *ifim = NLMSG_DATA(h);
 +	struct rtattr *rta;
 +	struct ifnamemap *e;
++
++	for (rta = NLMSG_RTA(h, sizeof(*ifim)); NLMSG_RTAOK(rta, h); rta = RTA_NEXT(rta)) {
++		if (rta->rta_type != IFLA_IFNAME) continue;
++		if (RTA_DATALEN(rta) > IFNAMSIZ) return -ENOBUFS;
  
 -	n = conf.ifc_len / sizeof(struct ifreq);
 -	for (i=k=0; i<n; i++) {
@@ -658,10 +592,6 @@ index 53b80b2..d4e8b2d 100644
 -		}
 -		idx[i-k].if_index = conf.ifc_req[i].ifr_ifindex;
 -		idx[i-k].if_name = conf.ifc_req[i].ifr_name;
-+	for (rta = NLMSG_RTA(h, sizeof(*ifim)); NLMSG_RTAOK(rta, h); rta = RTA_NEXT(rta)) {
-+		if (rta->rta_type != IFLA_IFNAME) continue;
-+		if (RTA_DATALEN(rta) > IFNAMSIZ) return -ENOBUFS;
-+
 +		ctx->num++;
 +		ctx->str_bytes += RTA_DATALEN(rta) + 1;
 +		e = realloc(ctx->list, sizeof(struct ifnamemap[ctx->num]));
@@ -690,15 +620,16 @@ index 53b80b2..d4e8b2d 100644
 -		__syscall(SYS_close, s);
 +	struct ifnameindexctx _ctx, *ctx = &_ctx;
 +	struct if_nameindex *ifs = NULL;
-+	struct __netlink_handle *nh;
-+	int r, i;
++	int fd, r, i;
 +	char *p;
 +
-+	nh = __netlink_open(NETLINK_ROUTE);
-+	if (!nh) goto err;
++	fd = socket(PF_NETLINK, SOCK_RAW|SOCK_CLOEXEC, NETLINK_ROUTE);
++	if (fd < 0) goto err;
++
 +	memset(ctx, 0, sizeof(*ctx));
-+	r = __netlink_enumerate(nh, RTM_GETLINK, __handle_link, ctx);
-+	__netlink_close(nh);
++	r = __netlink_enumerate(fd, 1, RTM_GETLINK, AF_UNSPEC, __handle_link, ctx);
++	__syscall(SYS_close,fd);
++
 +	if (r < 0) goto err;
 +
 +	ifs = malloc(sizeof(struct if_nameindex[ctx->num+1]) + ctx->str_bytes);
@@ -722,5 +653,5 @@ index 53b80b2..d4e8b2d 100644
 +	return ifs;
  }
 -- 
-1.9.1
+1.9.2
 
diff --git a/main/musl/APKBUILD b/main/musl/APKBUILD
index 9ec126bdd19962db42483e612bd5ed8acef59eed..b02b7f06d1e7a6ad4d59c932bcecc6a606ae089a 100644
--- a/main/musl/APKBUILD
+++ b/main/musl/APKBUILD
@@ -2,7 +2,7 @@
 # Maintainer: Timo Teräs <timo.teras@iki.fi>
 pkgname=musl
 pkgver=1.0.0
-pkgrel=8
+pkgrel=9
 pkgdesc="the musl c library (libc) implementation"
 url="http://www.musl-libc.org/"
 arch="all"
@@ -17,14 +17,15 @@ source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz
 	0001-v1.0.0-to-2b74315d.patch
 	0002-2b74315d-to-b9b2db2f.patch
 	0003-b9b2db2f-to-e94d0692.patch
+	0004-e94d0692-to-83c98aac.patch
+
 	1001-add-basic-dns-record-parsing-functions.patch
 	1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch
 
 	getopt_long.c
 	__stack_chk_fail_local.c
 	getconf.c
-	getent
-	ldconfig
+	getent.c
 	"
 
 _builddir="$srcdir"/musl-$pkgver
@@ -66,8 +67,9 @@ build() {
 	${CROSS_COMPILE}gcc $CPPFLAGS $CFLAGS -c "$srcdir"/__stack_chk_fail_local.c -o __stack_chk_fail_local.o || return 1
 	${CROSS_COMPILE}ar r libssp_nonshared.a __stack_chk_fail_local.o || return 1
 
-	# getconf
+	# getconf/getent
 	${CROSS_COMPILE}gcc $CPPFLAGS $CFLAGS "$srcdir"/getconf.c -o getconf || return 1
+	${CROSS_COMPILE}gcc $CPPFLAGS $CFLAGS "$srcdir"/getent.c -o getent || return 1
 
 	# note: not autotools
 	LDFLAGS="$LDFLAGS -Wl,-soname,libc.musl-${CARCH}.so.1" \
@@ -100,12 +102,15 @@ package() {
 
 utils() {
 	replaces="uclibc-utils"
-	mkdir -p "$subpkgdir"/usr/bin
+	mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/sbin
 	mv "$pkgdir"/usr/bin/ldd "$subpkgdir"/usr/bin
 	find "$pkgdir" -type d -delete 2>/dev/null
-	install -D "$srcdir"/getent "$subpkgdir"/usr/bin/getent
+	install -D "$_builddir"/getent "$subpkgdir"/usr/bin/getent
 	install -D "$_builddir"/getconf "$subpkgdir"/usr/bin/getconf
-	install -D "$srcdir"/ldconfig "$subpkgdir"/sbin/ldconfig
+	cat <<EOF > "$subpkgdir"/sbin/ldconfig
+#!/bin/sh
+exit 0
+EOF
 }
 
 crosstool() {
@@ -119,32 +124,32 @@ md5sums="e54664fdf211d27737e328c4462b545e  musl-1.0.0.tar.gz
 d081fc3424229c639e636be2dd00d221  0001-v1.0.0-to-2b74315d.patch
 48fa02a48a33bbcb8149edf6540d02f9  0002-2b74315d-to-b9b2db2f.patch
 d0a6498cede60e70c468d9a44b968abe  0003-b9b2db2f-to-e94d0692.patch
+1bd1787e961189215e0a60e9ed863529  0004-e94d0692-to-83c98aac.patch
 a3810683ef61ac27e2f6ec9801280c81  1001-add-basic-dns-record-parsing-functions.patch
-d7775d12bb7903094a384626e8b060be  1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch
+83c3bd2a50b1de5ef948704d3f4e0583  1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch
 61c6c1e84ed1df82abbe6d75e90cf21c  getopt_long.c
 0df687757221bbb0fc1aa67f1bd646f9  __stack_chk_fail_local.c
 7b391300396e58fe9073866b5a80cfe8  getconf.c
-ef81489a6258501cf45db58dfc6d5211  getent
-33e4fd94e2560e008e2c3b431d0e3419  ldconfig"
+2b941c4251cac44988a4abfc50e21267  getent.c"
 sha256sums="1ad7f45d2972daff19c9e6a92714e6d70f4aad003cd8c3d1e6113432114c1a32  musl-1.0.0.tar.gz
 aa632b635d472d5a6a49800899ce34cddc89a63a489690faa683d08622b9cd60  0001-v1.0.0-to-2b74315d.patch
 edc0cebaabd16f894d91c1860bfb70d3f2d9a70cf558c5455689610374447f7d  0002-2b74315d-to-b9b2db2f.patch
 8ee26d42062a4bc91a7fc95fe3f257b9ffcbef600a6344257f7681f358a4a012  0003-b9b2db2f-to-e94d0692.patch
+48a906fd2390b9d9015807c2d3d200c96fa4983faf229661d7158b62ae5dcfd2  0004-e94d0692-to-83c98aac.patch
 758390768b1bc4159d56908ca332b9640cd0552ed3b4b2b8d4a6d499c54c11a1  1001-add-basic-dns-record-parsing-functions.patch
-3809a7758c0c138a03fae7ad8e27a1c34090c44260a93fcbbb8966994755f450  1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch
+1c25880095e869b827f02997e864fdf4bf157a4e923e52d97dbd05e657aedb70  1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch
 d9b644ec20bc33e81a7c52b9fcf7973d835923a69faf50f03db45534b811bd96  getopt_long.c
 299a7d75a09de3e2e11e7fb4acc3182e4a14e868093d2f30938fce9bfcff13da  __stack_chk_fail_local.c
 530ea449f93d53fafcb377fa0a23a7564f2961e49c07a8fdef6c960110317301  getconf.c
-d6996273f5aaaed429058257e4646b243d9e3a4d8609522f802762453f5be4cb  getent
-306c6ca7407560340797866e077e053627ad409277d1b9da58106fce4cf717cb  ldconfig"
+68373a55e89ce85c562d941ccf588337d6cc6c9c17689d695f65cd7607134bbe  getent.c"
 sha512sums="c76cbfe60cbe9b1ceb1faedddf2dcce0f11c942c8f74e4f217efe63e8e1d7be70fcb6cf1182eeaee90441152c4493d678682cb247a0dbc7537d24f943a7bbdf8  musl-1.0.0.tar.gz
 e04f0f9de2859d18cb13aa8bfd839cc757aa9d835f133e46b48a760c7e689a92c641abe1e84dcaab6134c22500603e66d9a880f9b80b77e36a063348f5879878  0001-v1.0.0-to-2b74315d.patch
 19c09e09d61ba31caeece27ea4241be4f14f73ab958da7f37fc4f0c8391fcaa912a750a2b79c29b3fec24ad22995244c91d1f0372d9b8481c99411e2442c2d4e  0002-2b74315d-to-b9b2db2f.patch
 352b7c0693ebe6093e71d4e9cb704ff569e0e0ae2dcc576d3dc4883e7dddd1ffbc09d8365cceabbeec6b974496dddb9ed7bfacaa244c92c2735caf08c843593a  0003-b9b2db2f-to-e94d0692.patch
+13b22003bb8b40786e524df42ec9560d56f45265a531faf82e2285cc0c2e893937f4c32159ec75b99c7953dbeeef15b24c2e8dbe2145728e9b011ae8952a81f5  0004-e94d0692-to-83c98aac.patch
 dad965258daf69371b844f76bfe5a914b0eca0ca76f3fc340b8fd7acf598b5f87bbe6d68b1f43ed0293ee0ed3bfd85d5173ccc169aa6265646248d5b8a906708  1001-add-basic-dns-record-parsing-functions.patch
-d2477eca267dae1da25c5612e519a95048a7d651ed2f98b247c735bfd940aa2042624821e03c1f3ed6bc832ffcd0c1342f04bece80fd4aa37729ada222889e9c  1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch
+72cf33738d2cf31f6ec02312bc494d754c17470b519172bb8bd7e2e29ac3b119023088a2b3fbc0dbc2fddd0078ccbae62096106cae361f8c31d6a9950043af25  1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch
 140f3f20d30bd95ebce8c41b8cc7f616c6cbedf4ea06c729c21014e74f6043796825cc40ebc5180620ea38173afdba23f09ebf6d8b11fa05440b14d23764fca9  getopt_long.c
 062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b  __stack_chk_fail_local.c
 d638cdd02371351190fd0545fb83f44b822fa8c930e9fb47ef93d32a1aaee27641f875e10fa2e9833f1a56dfc2055fb89932a89c88da3e2eb17529bca58f5182  getconf.c
-4d92f934d760cf5157d80f19fd766be6b673c65317229b32ac824d9d192f6abcc414e2382b2416dfd5c2f757b46ced98c18e4762bf91f5a48647e0ee61813b06  getent
-69f097faa9ccb981e78c3a914ad68a51771637d9aecd2dbc807003ac30663e6d921091a48ff529dfff27a6cd55b0808f91683118acf7acdf406d37266e622b17  ldconfig"
+b35de9847353b273516162ed4828a810c6130fc5b7de44ee4433003b3f99647b25792d9b1c40dfc67069add11f3fb850e5c35d4f1912dccac108059bbbdfd5a2  getent.c"
diff --git a/main/musl/getent b/main/musl/getent
deleted file mode 100755
index d11befaf8dc622c3300e295a73d705c56ee79327..0000000000000000000000000000000000000000
--- a/main/musl/getent
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/sh
-# $Header: /var/cvs/uClibc/extra/scripts/getent,v 1.2 2005/02/02 14:18:01 solar Exp $
-#
-# Closely (not perfectly) emulate the behavior of glibc's getent utility
-#
-#passwd|shadow|group|aliases|hosts|networks|ethers|netgroup|protocols|services|rpc
-# only returns the first match (by design)
-# dns based search is not supported (hosts,networks)
-# case-insensitive matches not supported (ethers; others?)
-# may return false-positives (hosts,protocols,rpc,services,ethers)
-
-export PATH="${PATH}:/bin:/usr/bin"
-
-file="/etc/$1"
-case $1 in
-	passwd|group|shadow)
-		match="^$2:" ;;
-	networks|netgroup)
-		match="^[[:space:]]*$2\>" ;;
-	hosts|protocols|rpc|services|ethers)
-		match="\<$2\>" ;;
-	aliases)
-		match="^[[:space:]]*$2[[:space:]]*:" ;;
-	""|-h|--help)
-		echo "USAGE: $0 database [key]"
-		exit 0 ;;
-	*)
-		echo "$0: Unknown database: $1" 1>&2
-		exit 1 ;;
-esac
-
-if [ ! -f "$file" ] ; then
-	echo "$0: Could not find database file for $1" 1>&2
-	exit 1
-fi
-
-if [ $# -eq 1 ] ; then
-	exec cat "$file"
-else
-	sed "s/#.*//; /$match/q; d" "$file" | grep . || exit 2
-fi
diff --git a/main/musl/getent.c b/main/musl/getent.c
new file mode 100644
index 0000000000000000000000000000000000000000..1f97f8f32a69fb26b0a95092409e8613bff4f6f9
--- /dev/null
+++ b/main/musl/getent.c
@@ -0,0 +1,437 @@
+/*-
+ * Copyright (c) 2004-2006 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Luke Mewburn.
+ * Timo Teräs cleaned up the code for use in Alpine Linux with musl libc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/socket.h>
+#include <sys/param.h>
+#include <ctype.h>
+#include <errno.h>
+#include <limits.h>
+#include <netdb.h>
+#include <pwd.h>
+#include <grp.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <paths.h>
+#include <err.h>
+
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+
+#include <net/if.h>
+#include <net/ethernet.h>
+#include <netinet/ether.h>
+#include <netinet/in.h>
+
+enum {
+	RV_OK		= 0,
+	RV_USAGE	= 1,
+	RV_NOTFOUND	= 2,
+	RV_NOENUM	= 3
+};
+
+static int usage(const char *);
+
+static int parsenum(const char *word, unsigned long *result)
+{
+	unsigned long	num;
+	char		*ep;
+
+	if (!isdigit((unsigned char)word[0]))
+		return 0;
+	errno = 0;
+	num = strtoul(word, &ep, 10);
+	if (num == ULONG_MAX && errno == ERANGE)
+		return 0;
+	if (*ep != '\0')
+		return 0;
+	*result = num;
+	return 1;
+}
+
+/*
+ * printfmtstrings --
+ *	vprintf(format, ...),
+ *	then the aliases (beginning with prefix, separated by sep),
+ *	then a newline
+ */
+__attribute__ ((format (printf, 4, 5)))
+static void printfmtstrings(char *strings[], const char *prefix, const char *sep,
+	const char *fmt, ...)
+{
+	va_list		ap;
+	const char	*curpref;
+	size_t		i;
+
+	va_start(ap, fmt);
+	(void)vprintf(fmt, ap);
+	va_end(ap);
+
+	curpref = prefix;
+	for (i = 0; strings[i] != NULL; i++) {
+		(void)printf("%s%s", curpref, strings[i]);
+		curpref = sep;
+	}
+	(void)printf("\n");
+}
+
+static int ethers(int argc, char *argv[])
+{
+	char		hostname[MAXHOSTNAMELEN + 1], *hp;
+	struct ether_addr ea, *eap;
+	int		i, rv;
+
+	if (argc == 2) {
+		warnx("Enumeration not supported on ethers");
+		return RV_NOENUM;
+	}
+
+	rv = RV_OK;
+	for (i = 2; i < argc; i++) {
+		if ((eap = ether_aton(argv[i])) == NULL) {
+			eap = &ea;
+			hp = argv[i];
+			if (ether_hostton(hp, eap) != 0) {
+				rv = RV_NOTFOUND;
+				break;
+			}
+		} else {
+			hp = hostname;
+			if (ether_ntohost(hp, eap) != 0) {
+				rv = RV_NOTFOUND;
+				break;
+			}
+		}
+		(void)printf("%-17s  %s\n", ether_ntoa(eap), hp);
+	}
+	return rv;
+}
+
+static void groupprint(const struct group *gr)
+{
+	printfmtstrings(gr->gr_mem, ":", ",", "%s:%s:%u",
+			gr->gr_name, gr->gr_passwd, gr->gr_gid);
+}
+
+static int group(int argc, char *argv[])
+{
+	struct group	*gr;
+	unsigned long	id;
+	int		i, rv;
+
+	rv = RV_OK;
+	if (argc == 2) {
+		while ((gr = getgrent()) != NULL)
+			groupprint(gr);
+	} else {
+		for (i = 2; i < argc; i++) {
+			if (parsenum(argv[i], &id))
+				gr = getgrgid((gid_t)id);
+			else
+				gr = getgrnam(argv[i]);
+			if (gr == NULL) {
+				rv = RV_NOTFOUND;
+				break;
+			}
+			groupprint(gr);
+		}
+	}
+	endgrent();
+	return rv;
+}
+
+static void hostsprint(const struct hostent *he)
+{
+	char	buf[INET6_ADDRSTRLEN];
+
+	if (inet_ntop(he->h_addrtype, he->h_addr, buf, sizeof(buf)) == NULL)
+		(void)strlcpy(buf, "# unknown", sizeof(buf));
+	printfmtstrings(he->h_aliases, "  ", " ", "%-16s  %s", buf, he->h_name);
+}
+
+static int hosts(int argc, char *argv[])
+{
+	struct hostent	*he;
+	char		addr[IN6ADDRSZ];
+	int		i, rv;
+
+	sethostent(1);
+	rv = RV_OK;
+	if (argc == 2) {
+		while ((he = gethostent()) != NULL)
+			hostsprint(he);
+	} else {
+		for (i = 2; i < argc; i++) {
+			if (inet_pton(AF_INET6, argv[i], (void *)addr) > 0)
+				he = gethostbyaddr(addr, IN6ADDRSZ, AF_INET6);
+			else if (inet_pton(AF_INET, argv[i], (void *)addr) > 0)
+				he = gethostbyaddr(addr, INADDRSZ, AF_INET);
+			else
+				he = gethostbyname(argv[i]);
+			if (he == NULL) {
+				rv = RV_NOTFOUND;
+				break;
+			}
+			hostsprint(he);
+		}
+	}
+	endhostent();
+	return rv;
+}
+
+static void networksprint(const struct netent *ne)
+{
+	char		buf[INET6_ADDRSTRLEN];
+	struct	in_addr	ianet;
+
+	ianet = inet_makeaddr(ne->n_net, 0);
+	if (inet_ntop(ne->n_addrtype, &ianet, buf, sizeof(buf)) == NULL)
+		(void)strlcpy(buf, "# unknown", sizeof(buf));
+	printfmtstrings(ne->n_aliases, "  ", " ", "%-16s  %s", ne->n_name, buf);
+}
+
+static int networks(int argc, char *argv[])
+{
+	struct netent	*ne;
+	in_addr_t	net;
+	int		i, rv;
+
+	setnetent(1);
+	rv = RV_OK;
+	if (argc == 2) {
+		while ((ne = getnetent()) != NULL)
+			networksprint(ne);
+	} else {
+		for (i = 2; i < argc; i++) {
+			net = inet_network(argv[i]);
+			if (net != INADDR_NONE)
+				ne = getnetbyaddr(net, AF_INET);
+			else
+				ne = getnetbyname(argv[i]);
+			if (ne != NULL) {
+				rv = RV_NOTFOUND;
+				break;
+			}
+			networksprint(ne);
+		}
+	}
+	endnetent();
+	return rv;
+}
+
+static void passwdprint(struct passwd *pw)
+{
+	(void)printf("%s:%s:%u:%u:%s:%s:%s\n",
+		pw->pw_name, pw->pw_passwd, pw->pw_uid,
+		pw->pw_gid, pw->pw_gecos, pw->pw_dir, pw->pw_shell);
+}
+
+static int passwd(int argc, char *argv[])
+{
+	struct passwd	*pw;
+	unsigned long	id;
+	int		i, rv;
+
+	rv = RV_OK;
+	if (argc == 2) {
+		while ((pw = getpwent()) != NULL)
+			passwdprint(pw);
+	} else {
+		for (i = 2; i < argc; i++) {
+			if (parsenum(argv[i], &id))
+				pw = getpwuid((uid_t)id);
+			else
+				pw = getpwnam(argv[i]);
+			if (pw == NULL) {
+				rv = RV_NOTFOUND;
+				break;
+			}
+			passwdprint(pw);
+		}
+	}
+	endpwent();
+	return rv;
+}
+
+static void protocolsprint(struct protoent *pe)
+{
+	printfmtstrings(pe->p_aliases, "  ", " ",
+			"%-16s  %5d", pe->p_name, pe->p_proto);
+}
+
+static int protocols(int argc, char *argv[])
+{
+	struct protoent	*pe;
+	unsigned long	id;
+	int		i, rv;
+
+	setprotoent(1);
+	rv = RV_OK;
+	if (argc == 2) {
+		while ((pe = getprotoent()) != NULL)
+			protocolsprint(pe);
+	} else {
+		for (i = 2; i < argc; i++) {
+			if (parsenum(argv[i], &id))
+				pe = getprotobynumber((int)id);
+			else
+				pe = getprotobyname(argv[i]);
+			if (pe == NULL) {
+				rv = RV_NOTFOUND;
+				break;
+			}
+			protocolsprint(pe);
+		}
+	}
+	endprotoent();
+	return rv;
+}
+
+static void servicesprint(struct servent *se)
+{
+	printfmtstrings(se->s_aliases, "  ", " ",
+			"%-16s  %5d/%s",
+			se->s_name, ntohs(se->s_port), se->s_proto);
+
+}
+
+static int services(int argc, char *argv[])
+{
+	struct servent	*se;
+	unsigned long	id;
+	char		*proto;
+	int		i, rv;
+
+	setservent(1);
+	rv = RV_OK;
+	if (argc == 2) {
+		while ((se = getservent()) != NULL)
+			servicesprint(se);
+	} else {
+		for (i = 2; i < argc; i++) {
+			proto = strchr(argv[i], '/');
+			if (proto != NULL)
+				*proto++ = '\0';
+			if (parsenum(argv[i], &id))
+				se = getservbyport(htons(id), proto);
+			else
+				se = getservbyname(argv[i], proto);
+			if (se == NULL) {
+				rv = RV_NOTFOUND;
+				break;
+			}
+			servicesprint(se);
+		}
+	}
+	endservent();
+	return rv;
+}
+
+static int shells(int argc, char *argv[])
+{
+	const char	*sh;
+	int		i, rv;
+
+	setusershell();
+	rv = RV_OK;
+	if (argc == 2) {
+		while ((sh = getusershell()) != NULL)
+			(void)printf("%s\n", sh);
+	} else {
+		for (i = 2; i < argc; i++) {
+			setusershell();
+			while ((sh = getusershell()) != NULL) {
+				if (strcmp(sh, argv[i]) == 0) {
+					(void)printf("%s\n", sh);
+					break;
+				}
+			}
+			if (sh == NULL) {
+				rv = RV_NOTFOUND;
+				break;
+			}
+		}
+	}
+	endusershell();
+	return rv;
+}
+
+static struct getentdb {
+	const char	*name;
+	int		(*callback)(int, char *[]);
+} databases[] = {
+	{	"ethers",	ethers,		},
+	{	"group",	group,		},
+	{	"hosts",	hosts,		},
+	{	"networks",	networks,	},
+	{	"passwd",	passwd,		},
+	{	"protocols",	protocols,	},
+	{	"services",	services,	},
+	{	"shells",	shells,		},
+
+	{	NULL,		NULL,		},
+};
+
+static int usage(const char *arg0)
+{
+	struct getentdb	*curdb;
+	size_t i;
+
+	(void)fprintf(stderr, "Usage: %s database [key ...]\n", arg0);
+	(void)fprintf(stderr, "\tdatabase may be one of:");
+	for (i = 0, curdb = databases; curdb->name != NULL; curdb++, i++) {
+		if (i % 7 == 0)
+			(void)fputs("\n\t\t", stderr);
+		(void)fprintf(stderr, "%s%s", i % 7 == 0 ? "" : " ",
+		    curdb->name);
+	}
+	(void)fprintf(stderr, "\n");
+	exit(RV_USAGE);
+	/* NOTREACHED */
+}
+
+int
+main(int argc, char *argv[])
+{
+	struct getentdb	*curdb;
+
+	if (argc < 2)
+		usage(argv[0]);
+	for (curdb = databases; curdb->name != NULL; curdb++)
+		if (strcmp(curdb->name, argv[1]) == 0)
+			return (*curdb->callback)(argc, argv);
+
+	warn("Unknown database `%s'", argv[1]);
+	usage(argv[0]);
+	/* NOTREACHED */
+}
diff --git a/main/musl/ldconfig b/main/musl/ldconfig
deleted file mode 100755
index 039e4d0069c5c26909f86c505b9de66182e6d1f3..0000000000000000000000000000000000000000
--- a/main/musl/ldconfig
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-exit 0