From 72fabfe9b8318d7bfcf012e3f7b593374fb47730 Mon Sep 17 00:00:00 2001 From: Marc Prud'hommeaux Date: Wed, 19 Mar 2025 10:28:53 -0400 Subject: [PATCH] Handle strerror_r return type of UnsafeMutablePointer for Android --- Sources/TSCBasic/misc.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sources/TSCBasic/misc.swift b/Sources/TSCBasic/misc.swift index 58a302de..52e13bf6 100644 --- a/Sources/TSCBasic/misc.swift +++ b/Sources/TSCBasic/misc.swift @@ -327,7 +327,12 @@ extension SystemError: CustomStringConvertible { var cap = 64 while cap <= 16 * 1024 { var buf = [Int8](repeating: 0, count: cap) + #if os(Android) + let errptr: UnsafeMutablePointer = TSCLibc.strerror_r(errno, &buf, buf.count) + let err = Int(errptr.pointee) + #else let err = TSCLibc.strerror_r(errno, &buf, buf.count) + #endif if err == EINVAL { return "Unknown error \(errno)" }