From bfbb5c7b8b81b3d306e37e69f6c5546ded603750 Mon Sep 17 00:00:00 2001 From: xdavidwu Date: Sat, 31 Dec 2022 23:44:15 +0800 Subject: [PATCH] systemd: fix build on STRERROR --- ...3-errno-util-impl-non-glibc-STRERROR.patch | 32 +++++++++++++++++++ systemd/APKBUILD | 4 ++- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 systemd/0103-errno-util-impl-non-glibc-STRERROR.patch diff --git a/systemd/0103-errno-util-impl-non-glibc-STRERROR.patch b/systemd/0103-errno-util-impl-non-glibc-STRERROR.patch new file mode 100644 index 0000000..fc5048d --- /dev/null +++ b/systemd/0103-errno-util-impl-non-glibc-STRERROR.patch @@ -0,0 +1,32 @@ +From f8fc9170d42fce566071773e586d2e0985cc5d44 Mon Sep 17 00:00:00 2001 +From: xdavidwu +Date: Sat, 31 Dec 2022 23:42:41 +0800 +Subject: [PATCH] errno-util: impl non-glibc STRERROR() + +--- + src/basic/errno-util.h | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/src/basic/errno-util.h b/src/basic/errno-util.h +index 091f99c..112fd43 100644 +--- a/src/basic/errno-util.h ++++ b/src/basic/errno-util.h +@@ -14,7 +14,15 @@ + * https://stackoverflow.com/questions/34880638/compound-literal-lifetime-and-if-blocks + * + * Note that we use the GNU variant of strerror_r() here. */ ++#ifdef __GLIBC__ + #define STRERROR(errnum) strerror_r(abs(errnum), (char[ERRNO_BUF_LEN]){}, ERRNO_BUF_LEN) ++#else ++#define STRERROR(errnum) ({ \ ++ char *m = alloca(ERRNO_BUF_LEN); \ ++ strerror_r(abs(errnum), m, ERRNO_BUF_LEN); \ ++ m; \ ++}) ++#endif + + /* A helper to print an error message or message for functions that return 0 on EOF. + * Note that we can't use ({ … }) to define a temporary variable, so errnum is +-- +2.39.0 + diff --git a/systemd/APKBUILD b/systemd/APKBUILD index bc6a971..71d5530 100644 --- a/systemd/APKBUILD +++ b/systemd/APKBUILD @@ -35,7 +35,8 @@ source="$pkgname-$pkgver.tar.gz::https://github.com/systemd/systemd-stable/archi 0026-Handle-missing-gshadow.patch 0100-Do-not-buffer-on-systemd-sleep.patch 0101-efi-do-not-set-wide-exec-charset.patch - 0102-bootctl-include-bits-reg.h-for-musl-__WORD_SIZE.patch" + 0102-bootctl-include-bits-reg.h-for-musl-__WORD_SIZE.patch + 0103-errno-util-impl-non-glibc-STRERROR.patch" pkgusers="systemd-network systemd-resolve systemd-coredump" pkggroups="systemd-journal" provides="hwids-udev=99999999 eudev=99 eudev-libs=99" @@ -163,4 +164,5 @@ e9d3de0055ed19b46dbf448306546533f3bc5e5e14d557c02a491aec371d71734c89868c0dfb2733 aeca4851d4cef2439eca2519dd031a842d7699782edee06239ca66f157711faf16c2943b310963faaf06d3b8c02bb0390b900ea8900c88e5ecbfc000f7929ab6 0100-Do-not-buffer-on-systemd-sleep.patch daf52c1f16fc29688e45d9bdbc67dff93bb606da3ef95963e3bcbf79690527e6704b8dffc50886342dc213154a62650ee70533dd70e58d6fd6238c17d8aa6e43 0101-efi-do-not-set-wide-exec-charset.patch 22e2dd208002d296f29cdc06b0d57297de28b3166904bdebffba823dbd88650a54a1e96df056f73d444e318f46a2dd1727766f57a99ad5650d985cd24d9f9899 0102-bootctl-include-bits-reg.h-for-musl-__WORD_SIZE.patch +9cb49971ba916543138634fe293dd7900c967d7401ffa9e2bec2bc181dd8f8e03b529b132cdee63889f3c967ad2b03ec69575174e88c22cf3c36f217e29c5408 0103-errno-util-impl-non-glibc-STRERROR.patch " -- 2.45.2