1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
From 5ff06fd3c284aba49f53caede2bb8981e9109b12 Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Sat, 3 Sep 2022 01:04:58 +0800 Subject: Revert "fix #19600 No error checking on fclose (#19836)" (#20297) This reverts commit 04e4a5ec0e35fc7e1c346c2d002e8487b4b48cb5. --- lib/std/syncio.nim | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'lib/std/syncio.nim') diff --git a/lib/std/syncio.nim b/lib/std/syncio.nim index 4eeb1778d..22e981198 100644 --- a/lib/std/syncio.nim +++ b/lib/std/syncio.nim @@ -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. -- cgit 1.4.1-2-gfad0 '>refs log tree commit diff stats