commit: 2dab1e0a3d9d88883019be43fa70b85d29c30338
Author: Jory Pratt <anarchy <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 16 00:55:49 2021 +0000
Commit: Jory Pratt <anarchy <AT> gentoo <DOT> org>
CommitDate: Mon Aug 16 00:59:09 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2dab1e0a
sys-libs/musl: extend gethostid for zfs users
Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Jory Pratt <anarchy <AT> gentoo.org>
sys-libs/musl/files/musl-1.2.2-gethostid.patch | 43 ++++++++++++++++++++++
.../{musl-1.2.2-r2.ebuild => musl-1.2.2-r3.ebuild} | 7 ++++
2 files changed, 50 insertions(+)
diff --git a/sys-libs/musl/files/musl-1.2.2-gethostid.patch
b/sys-libs/musl/files/musl-1.2.2-gethostid.patch
new file mode 100644
index 00000000000..96c799cfca2
--- /dev/null
+++ b/sys-libs/musl/files/musl-1.2.2-gethostid.patch
@@ -0,0 +1,43 @@
+Subject: [musl] [PATCH] extend gethostid beyond a stub
+Archived-At:
<https://inbox.vuxu.org/musl/[email protected]/>
+List-Archive: <https://inbox.vuxu.org/musl/>
+List-Post: <mailto:[email protected]>
+
+From: Érico Rolim <[email protected]>
+
+Implement part of the glibc behavior, where the 32-bit identifier stored
+in /etc/hostid, if the file exists, is returned. If this file doesn't
+contain at least 32 bits or can't be opened for some reason, return 0.
+---
+ src/misc/gethostid.c | 15 ++++++++++++++-
+ 1 file changed, 14 insertions(+), 1 deletion(-)
+
+diff --git a/src/misc/gethostid.c b/src/misc/gethostid.c
+index 25bb35db..d529de9c 100644
+--- a/src/misc/gethostid.c
++++ b/src/misc/gethostid.c
+@@ -1,6 +1,19 @@
+ #include <unistd.h>
++#include <stdio.h>
++#include <stdint.h>
+
+ long gethostid()
+ {
+- return 0;
++ FILE *f;
++ int32_t rv = 0;
++
++ f = fopen("/etc/hostid", "reb");
++ if (f) {
++ if (fread(&rv, sizeof(rv), 1, f) == 0) {
++ rv = 0;
++ }
++ fclose(f);
++ }
++
++ return rv;
+ }
+--
+2.31.1
+
+
diff --git a/sys-libs/musl/musl-1.2.2-r2.ebuild
b/sys-libs/musl/musl-1.2.2-r3.ebuild
similarity index 96%
rename from sys-libs/musl/musl-1.2.2-r2.ebuild
rename to sys-libs/musl/musl-1.2.2-r3.ebuild
index 905348ba854..465a763222d 100644
--- a/sys-libs/musl/musl-1.2.2-r2.ebuild
+++ b/sys-libs/musl/musl-1.2.2-r3.ebuild
@@ -71,6 +71,13 @@ src_unpack() {
cp "${DISTDIR}"/iconv.c misc/iconv.c || die
}
+src_prepare() {
+ default
+
+ # Expand gethostid instead of being just a stub
+ eapply "${FILESDIR}/${PN}-1.2.2-gethostid.patch"
+}
+
src_configure() {
tc-getCC ${CTARGET}
just_headers && export CC=true