chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import Darwin
|
||||
|
||||
public enum UnixSocketPathSafety {
|
||||
public static func isSocketMode(_ mode: mode_t) -> Bool {
|
||||
(mode & mode_t(S_IFMT)) == mode_t(S_IFSOCK)
|
||||
}
|
||||
|
||||
public static func shouldRejectExistingPathAfterBindFailure(
|
||||
bindErrno: Int32,
|
||||
existingMode: mode_t?
|
||||
) -> Bool {
|
||||
bindErrno == EADDRINUSE && existingMode.map { !isSocketMode($0) } == true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user