diff --git a/srcpkgs/xinetd/patches/musl.patch b/srcpkgs/xinetd/patches/musl.patch
new file mode 100644
index 00000000000..908807b6990
--- /dev/null
+++ b/srcpkgs/xinetd/patches/musl.patch
@@ -0,0 +1,11 @@
+--- xinetd/confparse.c.orig	2015-05-31 12:28:33.148468478 +0200
++++ xinetd/confparse.c	2015-05-31 12:28:41.588557956 +0200
+@@ -746,7 +746,7 @@ static status_e check_entry( struct serv
+    }
+ 
+ /* #ifndef NO_RPC */
+-#if defined(HAVE_RPC_RPCENT_H) || defined(HAVE_NETDB_H)
++#if defined(HAVE_RPC_RPCENT_H) && defined(HAVE_NETDB_H)
+    if ( SC_IS_RPC( scp ) && !SC_IS_UNLISTED( scp ) )
+    {
+       struct rpcent *rep = (struct rpcent *)getrpcbyname( SC_NAME(scp) ) ;
diff --git a/srcpkgs/xinetd/template b/srcpkgs/xinetd/template
index 9ec194eaf1c..d874b156a8e 100644
--- a/srcpkgs/xinetd/template
+++ b/srcpkgs/xinetd/template
@@ -1,7 +1,7 @@
 # Template file for 'xinetd'
 pkgname=xinetd
 version=2.3.15
-revision=5
+revision=6
 build_pie=yes
 build_style=gnu-configure
 configure_args="--without-libwrap"
@@ -14,8 +14,13 @@ checksum=bf4e060411c75605e4dcbdf2ac57c6bd9e1904470a2f91e01ba31b50a80a5be3
 
 conf_files="/etc/xinetd.conf /etc/xinetd.d/servers /etc/xinetd.d/services"
 
+pre_configure() {
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl) export CFLAGS+=" -DNO_RPC"; configure_args+=" xinetd_cv_type_rlim_t=yes";;
+	esac
+}
 do_install() {
-	make prefix=${DESTDIR}/usr MANDIR=${DESTDIR}/usr/share/man install
+	make prefix=${DESTDIR}/usr DAEMONDIR=${DESTDIR}/usr/bin MANDIR=${DESTDIR}/usr/share/man install
 
 	vconf ${FILESDIR}/xinetd.conf
 	vinstall ${FILESDIR}/servers 644 etc/xinetd.d