Skip to content

Commit 3b83850

Browse files
committed
[sys] Fix bogus fclose() on failure.
1 parent ed68afa commit 3b83850

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Sources/sys/File.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ public class FileLineGenerator: GeneratorType, SequenceType {
6060
}
6161

6262
deinit {
63-
fclose(fp)
63+
if fp != nil {
64+
fclose(fp)
65+
}
6466
}
6567

6668
public func next() -> String? {

0 commit comments

Comments
 (0)