From e2db47eaae00ec33f8971db44b68645c5d3b9590 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Tue, 17 Aug 2021 11:36:49 +0100 Subject: gentoo resync : 17.08.2021 --- sys-libs/musl/files/musl-1.2.2-gethostid.patch | 43 ++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 sys-libs/musl/files/musl-1.2.2-gethostid.patch (limited to 'sys-libs/musl/files/musl-1.2.2-gethostid.patch') 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: +List-Archive: +List-Post: + +From: Érico Rolim + +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 ++#include ++#include + + 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 + + -- cgit v1.2.3