mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-16 14:01:22 +00:00
Update posix open() call to incl. permissions
This explicitly grants user read/write access to newly-created mmap files. Previously, on some systems files would be created but could not be re-opened as the user lacked sufficient permissions.
This commit is contained in:
@@ -178,8 +178,11 @@ proc open*(filename: string, mode: TFileMode = fmRead,
|
||||
|
||||
if newFileSize != -1:
|
||||
flags = flags or O_CREAT or O_TRUNC
|
||||
var permissions_mode = S_IRUSR or S_IWUSR
|
||||
result.handle = open(filename, flags, permissions_mode)
|
||||
else:
|
||||
result.handle = open(filename, flags)
|
||||
|
||||
result.handle = open(filename, flags)
|
||||
if result.handle == -1:
|
||||
# XXX: errno is supposed to be set here
|
||||
# Is there an exception that wraps it?
|
||||
|
||||
Reference in New Issue
Block a user