File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -249,12 +249,12 @@ class TestNSTask : XCTestCase {
249249
250250private func mkstemp( template: String , body: ( FileHandle ) throws -> Void ) rethrows {
251251 let url = URL ( fileURLWithPath: NSTemporaryDirectory ( ) ) . appendingPathComponent ( " TestNSTask.XXXXXX " )
252- var buffer = [ Int8 ] ( repeating : 0 , count : Int ( PATH_MAX ) )
252+
253253 try url. withUnsafeFileSystemRepresentation {
254- switch mkstemp ( UnsafeMutablePointer ( mutating: $0) ) {
254+ switch mkstemp ( UnsafeMutablePointer ( mutating: $0! ) ) {
255255 case - 1 : XCTFail ( " Could not create temporary file " )
256256 case let fd:
257- defer { unlink ( & buffer ) }
257+ defer { url . withUnsafeFileSystemRepresentation { _ = unlink ( $0! ) } }
258258 try body ( FileHandle ( fileDescriptor: fd, closeOnDealloc: true ) )
259259 }
260260 }
Original file line number Diff line number Diff line change @@ -243,7 +243,7 @@ class TestNSURL : XCTestCase {
243243 let cwdURL = URL ( fileURLWithPath: cwd, isDirectory: true )
244244 // 1 for path separator
245245 cwdURL. withUnsafeFileSystemRepresentation {
246- gRelativeOffsetFromBaseCurrentWorkingDirectory = UInt ( strlen ( $0) + 1 )
246+ gRelativeOffsetFromBaseCurrentWorkingDirectory = UInt ( strlen ( $0! ) + 1 )
247247 }
248248
249249
You can’t perform that action at this time.
0 commit comments