From 93d13363c605fb2de484f38f3726f8fbad1c3540 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 2 Aug 2023 12:20:40 -0700
Subject: [PATCH 21/26] shared: Do not use malloc_info on musl

Upstream-Status: Inappropriate [musl-specific]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 src/shared/bus-util.c      | 5 +++--
 src/shared/common-signal.c | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
index ff80e580fc..a628a29d0c 100644
--- a/src/shared/bus-util.c
+++ b/src/shared/bus-util.c
@@ -787,15 +787,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat
         _cleanup_close_ int fd = -EBADF;
         size_t dump_size;
         FILE *f;
-        int r;
+        int r = 0;
 
         assert(message);
 
         f = memstream_init(&m);
         if (!f)
                 return -ENOMEM;
-
+#ifdef __GLIBC__
         r = RET_NERRNO(malloc_info(/* options= */ 0, f));
+#endif
         if (r < 0)
                 return r;
 
diff --git a/src/shared/common-signal.c b/src/shared/common-signal.c
index 8e70e365dd..9e782caec9 100644
--- a/src/shared/common-signal.c
+++ b/src/shared/common-signal.c
@@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo
                         log_oom();
                         break;
                 }
-
+#ifdef __GLIBC__
                 if (malloc_info(0, f) < 0) {
                         log_error_errno(errno, "Failed to invoke malloc_info(): %m");
                         break;
                 }
-
+#endif
                 (void) memstream_dump(LOG_INFO, &m);
                 break;
         }
-- 
2.34.1

