minor code cleanups (#21215)
This commit is contained in:
parent
e9ed090c33
commit
cf1b16ef8b
6 changed files with 32 additions and 36 deletions
|
|
@ -43,8 +43,8 @@ proc uname*(): Uname =
|
|||
result.machine = charArrayToString u.machine
|
||||
|
||||
proc fsync*(fd: int) =
|
||||
## synchronize a file's buffer cache to the storage device
|
||||
if fsync(fd.cint) != 0:
|
||||
## synchronize a file's buffer cache to the storage device
|
||||
if fsync(fd.cint) != 0:
|
||||
raise newException(OSError, $strerror(errno))
|
||||
|
||||
proc stat*(path: string): Stat =
|
||||
|
|
@ -90,7 +90,7 @@ proc mkstemp*(prefix: string, suffix=""): (string, File) =
|
|||
## Returns the filename and a file opened in r/w mode.
|
||||
var tmpl = cstring(prefix & "XXXXXX" & suffix)
|
||||
let fd =
|
||||
if len(suffix)==0:
|
||||
if len(suffix) == 0:
|
||||
when declared(mkostemp):
|
||||
mkostemp(tmpl, O_CLOEXEC)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue