summaryrefslogtreecommitdiff
path: root/user/elogind/fix-rlim-fmt.patch
diff options
context:
space:
mode:
Diffstat (limited to 'user/elogind/fix-rlim-fmt.patch')
-rw-r--r--user/elogind/fix-rlim-fmt.patch40
1 files changed, 40 insertions, 0 deletions
diff --git a/user/elogind/fix-rlim-fmt.patch b/user/elogind/fix-rlim-fmt.patch
new file mode 100644
index 000000000..cfb943e48
--- /dev/null
+++ b/user/elogind/fix-rlim-fmt.patch
@@ -0,0 +1,40 @@
+%ju is uintmax_t which is unsigned long, not unsigned long long.
+
+Using the glibc code gives the same error - PRIu64 is unsigned long, not ll.
+
+Upstream-URL: https://github.com/elogind/elogind/issues/269
+
+--- elogind-252.9/src/basic/format-util.h.old 2023-05-15 06:35:29.000000000 -0500
++++ elogind-252.9/src/basic/format-util.h 2023-11-27 05:11:43.903588357 -0600
+@@ -34,7 +34,7 @@
+ # error Unknown timex member size
+ #endif
+
+-#ifdef __GLIBC__ /// Go directly for %ju in elogind if not. Enhances musl-libc compatibility.
++#ifdef __GLIBC__ /// Go directly for %llu in elogind if not. Enhances musl-libc compatibility.
+ #if SIZEOF_RLIM_T == 8
+ # define RLIM_FMT "%" PRIu64
+ #elif SIZEOF_RLIM_T == 4
+@@ -43,7 +43,7 @@
+ # error Unknown rlim_t size
+ #endif
+ #else // __GLIBC__
+-#define RLIM_FMT "%ju"
++#define RLIM_FMT "%llu"
+ #endif // __GLIBC__
+
+ #if SIZEOF_DEV_T == 8
+--- elogind-252.9/src/basic/rlimit-util.c.old 2023-05-15 06:35:29.000000000 -0500
++++ elogind-252.9/src/basic/rlimit-util.c 2023-11-27 05:21:02.633167487 -0600
+@@ -407,11 +407,7 @@
+
+ rl.rlim_cur = FD_SETSIZE;
+ if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
+-#ifdef __GLIBC__ /// To be compatible with musl-libc, elogind uses an (uintmax_t) cast.
+ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
+-#else // __GLIBC__
+- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
+-#endif // __GLIBC__
+
+ return 1;
+ }