summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJory Pratt <anarchy@gentoo.org>2021-08-15 19:55:49 -0500
committerJory Pratt <anarchy@gentoo.org>2021-08-15 19:59:09 -0500
commit2dab1e0a3d9d88883019be43fa70b85d29c30338 (patch)
tree5a61c374ef3c6486ae736f7d24564f227c102d2e /sys-libs
parentapp-text/asciidoc: add github upstream metadata (diff)
downloadgentoo-2dab1e0a3d9d88883019be43fa70b85d29c30338.tar.gz
gentoo-2dab1e0a3d9d88883019be43fa70b85d29c30338.tar.bz2
gentoo-2dab1e0a3d9d88883019be43fa70b85d29c30338.zip
sys-libs/musl: extend gethostid for zfs users
Package-Manager: Portage-3.0.20, Repoman-3.0.3 Signed-off-by: Jory Pratt <anarchy@gentoo.org>
Diffstat (limited to 'sys-libs')
-rw-r--r--sys-libs/musl/files/musl-1.2.2-gethostid.patch43
-rw-r--r--sys-libs/musl/musl-1.2.2-r3.ebuild (renamed from sys-libs/musl/musl-1.2.2-r2.ebuild)7
2 files changed, 50 insertions, 0 deletions
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 000000000000..96c799cfca29
--- /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/20210420191519.23822-3-ericonr@disroot.org/>
+List-Archive: <https://inbox.vuxu.org/musl/>
+List-Post: <mailto:musl@inbox.vuxu.org>
+
+From: Érico Rolim <erico.erc@gmail.com>
+
+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
index 905348ba854e..465a763222db 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