Skip to content

Commit bff194e

Browse files
committed
Always close file descriptor (eventually runs out of them!)
1 parent 6c02259 commit bff194e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Foundation/NSData.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,9 @@ extension NSData {
255255
remaining -= amt
256256
total += amt
257257
}
258+
259+
close(fd)
258260
if remaining != 0 {
259-
close(fd)
260261
throw NSError(domain: NSPOSIXErrorDomain, code: Int(errno), userInfo: nil)
261262
}
262263

0 commit comments

Comments
 (0)