Revert "fix #19600 No error checking on fclose (#19836)" (#20297)

This reverts commit 04e4a5ec0e.
This commit is contained in:
ringabout
2022-09-03 01:04:58 +08:00
committed by GitHub
parent 2a34d143ac
commit 5ff06fd3c2
2 changed files with 2 additions and 14 deletions

View File

@@ -324,9 +324,7 @@ const
proc close*(f: File) {.tags: [], gcsafe.} =
## Closes the file.
if not f.isNil:
let x = c_fclose(f)
if x < 0:
checkErr(f)
discard c_fclose(f)
proc readChar*(f: File): char {.tags: [ReadIOEffect].} =
## Reads a single character from the stream `f`. Should not be used in
@@ -691,7 +689,7 @@ when defined(posix) and not defined(nimscript):
proc open*(f: var File, filename: string,
mode: FileMode = fmRead,
bufSize: int = -1): bool {.tags: [], raises: [IOError], benign.} =
bufSize: int = -1): bool {.tags: [], raises: [], benign.} =
## Opens a file named `filename` with given `mode`.
##
## Default mode is readonly. Returns true if the file could be opened.

View File

@@ -1,10 +0,0 @@
discard """
targets: "c cpp"
disabled: "win"
disabled: "osx"
disabled: "linux"
exitcode: 1
outputsub: "No space left on device"
"""
writeFile("/dev/full", "hello\n")