new file mode 100644
@@ -0,0 +1,36 @@
+From 54883e714b7fd1e7f4ce47eb1fc09adff35d561e Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 7 May 2022 12:15:22 -0700
+Subject: [PATCH] Define strndupa if it does not exist
+
+musl e.g. does not supply strndupa, unlike glibc
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ etc/systemd/system-generators/zfs-mount-generator.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/etc/systemd/system-generators/zfs-mount-generator.c b/etc/systemd/system-generators/zfs-mount-generator.c
+index b806339..592d2f9 100644
+--- a/etc/systemd/system-generators/zfs-mount-generator.c
++++ b/etc/systemd/system-generators/zfs-mount-generator.c
+@@ -47,6 +47,15 @@
+ #define STRCMP ((int(*)(const void *, const void *))&strcmp)
+ #define PID_T_CMP ((int(*)(const void *, const void *))&pid_t_cmp)
+
++#ifndef strndupa
++#define strndupa(s, n) \
++ (__extension__ ({const char *__in = (s); \
++ size_t __len = strnlen (__in, (n)) + 1; \
++ char *__out = (char *) alloca (__len); \
++ __out[__len-1] = '\0'; \
++ (char *) memcpy (__out, __in, __len-1);}))
++#endif
++
+ static int
+ pid_t_cmp(const pid_t *lhs, const pid_t *rhs)
+ {
+--
+2.36.0
+
@@ -5,7 +5,9 @@ LICENSE = "CDDL-1.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=7087caaf1dc8a2856585619f4a787faa"
HOMEPAGE ="https://github.com/openzfs/zfs"
-SRC_URI = "https://github.com/openzfs/zfs/releases/download/${BPN}-${PV}/${BPN}-${PV}.tar.gz"
+SRC_URI = "https://github.com/openzfs/zfs/releases/download/${BPN}-${PV}/${BPN}-${PV}.tar.gz \
+ file://0001-Define-strndupa-if-it-does-not-exist.patch \
+"
SRC_URI[sha256sum] = "3b52c0d493f806f638dca87dde809f53861cd318c1ebb0e60daeaa061cf1acf6"
# Using both 'module' and 'autotools' classes seems a bit odd, they both
musl does not provide strndupa Signed-off-by: Khem Raj <raj.khem@gmail.com> Cc: Windel Bouwman <windel@windel.nl> --- ...Define-strndupa-if-it-does-not-exist.patch | 36 +++++++++++++++++++ .../recipes-filesystems/zfs/zfs_2.1.4.bb | 4 ++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 meta-filesystems/recipes-filesystems/zfs/zfs/0001-Define-strndupa-if-it-does-not-exist.patch