diff options
| author | Khem Raj <raj.khem@gmail.com> | 2023-01-24 20:03:56 -0800 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-01-26 21:06:57 +0000 |
| commit | d02bad4ab06a08515c67465dbf60cc38a5968905 (patch) | |
| tree | 22752b14d18b437da93af0d042b893881098fdaf | |
| parent | ff47bf6ed912d3cef7e47c052221f821cace03e2 (diff) | |
| download | poky-d02bad4ab06a08515c67465dbf60cc38a5968905.tar.gz | |
systemd: Add another fix for using XSI strerror_r
This makes systemd continue to work on musl
(From OE-Core rev: c76dae4d937728e8687c03b58ec720a2d3d496ed)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/recipes-core/systemd/systemd/0001-errno-util-Make-STRERROR-portable-for-musl.patch | 42 | ||||
| -rw-r--r-- | meta/recipes-core/systemd/systemd_252.4.bb | 1 |
2 files changed, 43 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd/0001-errno-util-Make-STRERROR-portable-for-musl.patch b/meta/recipes-core/systemd/systemd/0001-errno-util-Make-STRERROR-portable-for-musl.patch new file mode 100644 index 0000000000..2fb8985ad1 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0001-errno-util-Make-STRERROR-portable-for-musl.patch | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | From f66b5c802ce0a3310f5580cfc1b02446f8087568 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Mon, 23 Jan 2023 23:39:46 -0800 | ||
| 4 | Subject: [PATCH] errno-util: Make STRERROR portable for musl | ||
| 5 | |||
| 6 | Sadly, systemd has decided to use yet another GNU extention in a macro | ||
| 7 | lets make this such that we can use XSI compliant strerror_r() for | ||
| 8 | non-glibc hosts | ||
| 9 | |||
| 10 | Upstream-Status: Inappropriate [musl specific] | ||
| 11 | |||
| 12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 13 | --- | ||
| 14 | src/basic/errno-util.h | 12 ++++++++++-- | ||
| 15 | 1 file changed, 10 insertions(+), 2 deletions(-) | ||
| 16 | |||
| 17 | diff --git a/src/basic/errno-util.h b/src/basic/errno-util.h | ||
| 18 | index 091f99c590..eb5c1f9961 100644 | ||
| 19 | --- a/src/basic/errno-util.h | ||
| 20 | +++ b/src/basic/errno-util.h | ||
| 21 | @@ -14,8 +14,16 @@ | ||
| 22 | * https://stackoverflow.com/questions/34880638/compound-literal-lifetime-and-if-blocks | ||
| 23 | * | ||
| 24 | * Note that we use the GNU variant of strerror_r() here. */ | ||
| 25 | -#define STRERROR(errnum) strerror_r(abs(errnum), (char[ERRNO_BUF_LEN]){}, ERRNO_BUF_LEN) | ||
| 26 | - | ||
| 27 | +static inline const char * STRERROR(int errnum); | ||
| 28 | + | ||
| 29 | +static inline const char * STRERROR(int errnum) { | ||
| 30 | +#ifdef __GLIBC__ | ||
| 31 | + return strerror_r(abs(errnum), (char[ERRNO_BUF_LEN]){}, ERRNO_BUF_LEN); | ||
| 32 | +#else | ||
| 33 | + static __thread char buf[ERRNO_BUF_LEN]; | ||
| 34 | + return strerror_r(abs(errnum), buf, ERRNO_BUF_LEN) ? "unknown error" : buf; | ||
| 35 | +#endif | ||
| 36 | +} | ||
| 37 | /* A helper to print an error message or message for functions that return 0 on EOF. | ||
| 38 | * Note that we can't use ({ … }) to define a temporary variable, so errnum is | ||
| 39 | * evaluated twice. */ | ||
| 40 | -- | ||
| 41 | 2.39.1 | ||
| 42 | |||
diff --git a/meta/recipes-core/systemd/systemd_252.4.bb b/meta/recipes-core/systemd/systemd_252.4.bb index d291a2a9a1..e6c873f53b 100644 --- a/meta/recipes-core/systemd/systemd_252.4.bb +++ b/meta/recipes-core/systemd/systemd_252.4.bb | |||
| @@ -50,6 +50,7 @@ SRC_URI_MUSL = "\ | |||
| 50 | file://0002-Add-sys-stat.h-for-S_IFDIR.patch \ | 50 | file://0002-Add-sys-stat.h-for-S_IFDIR.patch \ |
| 51 | file://0001-Adjust-for-musl-headers.patch \ | 51 | file://0001-Adjust-for-musl-headers.patch \ |
| 52 | file://0001-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch \ | 52 | file://0001-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch \ |
| 53 | file://0001-errno-util-Make-STRERROR-portable-for-musl.patch \ | ||
| 53 | " | 54 | " |
| 54 | 55 | ||
| 55 | PAM_PLUGINS = " \ | 56 | PAM_PLUGINS = " \ |
