diff --git a/Sources/System/Internals/Mocking.swift b/Sources/System/Internals/Mocking.swift index 4a2a265..b1ca485 100644 --- a/Sources/System/Internals/Mocking.swift +++ b/Sources/System/Internals/Mocking.swift @@ -138,10 +138,10 @@ internal var forceWindowsPaths: Bool { #if ENABLE_MOCKING // Strip the mock_system prefix and the arg list suffix -private func originalSyscallName(_ s: String) -> String { +private func originalSyscallName(_ function: String) -> String { // `function` must be of format `system_()` - precondition(s.starts(with: "system_")) - return String(s.dropFirst("system_".count).prefix { $0.isLetter }) + precondition(function.starts(with: "system_")) + return String(function.dropFirst("system_".count).prefix { $0 != "(" }) } private func mockImpl( diff --git a/Sources/System/Internals/Syscalls.swift b/Sources/System/Internals/Syscalls.swift index e4897cc..a755928 100644 --- a/Sources/System/Internals/Syscalls.swift +++ b/Sources/System/Internals/Syscalls.swift @@ -102,14 +102,14 @@ internal func system_pwrite( return pwrite(fd, buf, nbyte, offset) } -public func system_dup(_ fd: Int32) -> Int32 { +internal func system_dup(_ fd: Int32) -> Int32 { #if ENABLE_MOCKING if mockingEnabled { return _mock(fd) } #endif return dup(fd) } -public func system_dup2(_ fd: Int32, _ fd2: Int32) -> Int32 { +internal func system_dup2(_ fd: Int32, _ fd2: Int32) -> Int32 { #if ENABLE_MOCKING if mockingEnabled { return _mock(fd, fd2) } #endif