Skip to content

Commit f7f0d74

Browse files
committed
Merge pull request #123 from aciidb0mb3r/patch-2
Use libc instead of OS check for strerror
2 parents 872d07f + 3581bff commit f7f0d74

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

Sources/POSIX/Error.swift

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,14 @@ public enum SystemError: ErrorType {
3535
case waitpid(Int32)
3636
}
3737

38-
#if os(OSX)
39-
import func Darwin.strerror
40-
#else
41-
import func Glibc.strerror
42-
#endif
38+
import func libc.strerror
4339

4440

4541
extension SystemError: CustomStringConvertible {
4642
public var description: String {
4743

4844
func strerror(errno: Int32) -> String {
49-
#if os(OSX)
50-
let cmsg = Darwin.strerror(errno)
51-
#else
52-
let cmsg = Glibc.strerror(errno)
53-
#endif
45+
let cmsg = libc.strerror(errno)
5446
let msg = String.fromCString(cmsg) ?? "Unknown Error"
5547
return "\(msg) (\(errno))"
5648
}

0 commit comments

Comments
 (0)