summaryrefslogtreecommitdiff
path: root/user/elogind/fix-rlim-fmt.patch
blob: cfb943e48716908e7b9862acfeba767b93116efc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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;
 }