commit:     0d01fa27133628b645a5127427d9a66a5654798e
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed May 17 02:37:08 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed May 17 02:37:08 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0d01fa27

sys-auth/elogind: fixup musl+selinux patch

I was missing a few hunks (which weren't in the rebased version shared)
and I should've noticed, oops.

Closes: https://bugs.gentoo.org/888912
Fixes: 93f87ff3f4ae7df427ce82b3c95ac89b3f418142
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/elogind-246.10-musl-selinux.patch        | 45 +++++++++++++++++++++-
 1 file changed, 43 insertions(+), 2 deletions(-)

diff --git a/sys-auth/elogind/files/elogind-246.10-musl-selinux.patch 
b/sys-auth/elogind/files/elogind-246.10-musl-selinux.patch
index 508bf037ccf1..433184edd102 100644
--- a/sys-auth/elogind/files/elogind-246.10-musl-selinux.patch
+++ b/sys-auth/elogind/files/elogind-246.10-musl-selinux.patch
@@ -37,7 +37,7 @@ not otherwise.
          _Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"")
 --- a/src/basic/selinux-util.c
 +++ b/src/basic/selinux-util.c
-@@ -72,6 +72,17 @@ void mac_selinux_retest(void) {
+@@ -72,12 +72,21 @@ void mac_selinux_retest(void) {
  #endif
  }
  
@@ -49,9 +49,50 @@ not otherwise.
 +REENABLE_WARNING
 +}
 +#else
-+#     warning "mallinfo() is missing, add mallinfo2() supported instead."
++#     warning "mallinfo() is missing, add mallinfo2() support instead."
 +#endif
 +
  int mac_selinux_init(void) {
  #if HAVE_SELINUX
          usec_t before_timestamp, after_timestamp;
+-        struct mallinfo before_mallinfo, after_mallinfo;
+         char timespan[FORMAT_TIMESPAN_MAX];
+-        int l;
+ 
+         selinux_set_callback(SELINUX_CB_POLICYLOAD, (union selinux_callback) 
mac_selinux_reload);
+ 
+@@ -87,7 +96,9 @@ int mac_selinux_init(void) {
+         if (!mac_selinux_use())
+                 return 0;
+ 
+-        before_mallinfo = mallinfo();
++#if HAVE_MALLINFO
++        struct mallinfo before_mallinfo = mallinfo_nowarn();
++#endif
+         before_timestamp = now(CLOCK_MONOTONIC);
+ 
+         label_hnd = selabel_open(SELABEL_CTX_FILE, NULL, 0);
+@@ -95,14 +106,16 @@ int mac_selinux_init(void) {
+                 return log_enforcing_errno(errno, "Failed to initialize 
SELinux labeling handle: %m");
+ 
+         after_timestamp = now(CLOCK_MONOTONIC);
+-        after_mallinfo = mallinfo();
+-
+-        l = after_mallinfo.uordblks > before_mallinfo.uordblks ? 
after_mallinfo.uordblks - before_mallinfo.uordblks : 0;
++#if HAVE_MALLINFO
++        struct mallinfo after_mallinfo = mallinfo_nowarn();
++        int l = after_mallinfo.uordblks > before_mallinfo.uordblks ? 
after_mallinfo.uordblks - before_mallinfo.uordblks : 0;
+ 
+         log_debug("Successfully loaded SELinux database in %s, size on heap 
is %iK.",
+                   format_timespan(timespan, sizeof(timespan), after_timestamp 
- before_timestamp, 0),
+-                  (l+1023)/1024);
+-
++                  DIV_ROUND_UP(l, 1024));
++#else
++        log_debug("Successfully loaded SELinux database in %s.",
++                  format_timespan(timespan, sizeof(timespan), after_timestamp 
- before_timestamp, 0));
+ #endif
+         return 0;
+ }
+-- 
+2.40.1

Reply via email to