mac: silence proc_pidpath warning
parent
08f8f58971
commit
5bbc7c8ba2
|
|
@ -243,7 +243,9 @@ actor PortGuardian {
|
||||||
var buffer = [CChar](repeating: 0, count: Int(PATH_MAX))
|
var buffer = [CChar](repeating: 0, count: Int(PATH_MAX))
|
||||||
let length = proc_pidpath(pid, &buffer, UInt32(buffer.count))
|
let length = proc_pidpath(pid, &buffer, UInt32(buffer.count))
|
||||||
guard length > 0 else { return nil }
|
guard length > 0 else { return nil }
|
||||||
return String(cString: buffer)
|
// Drop trailing null and decode as UTF-8.
|
||||||
|
let trimmed = buffer.prefix { $0 != 0 }
|
||||||
|
return String(decoding: trimmed.map { UInt8(bitPattern: $0) }, as: UTF8.self)
|
||||||
#else
|
#else
|
||||||
return nil
|
return nil
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue