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:
parent
c210e1255c
commit
a309a5f38a
1 changed files with 4 additions and 1 deletions
|
|
@ -178,8 +178,11 @@ proc open*(filename: string, mode: TFileMode = fmRead,
|
||||||
|
|
||||||
if newFileSize != -1:
|
if newFileSize != -1:
|
||||||
flags = flags or O_CREAT or O_TRUNC
|
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:
|
if result.handle == -1:
|
||||||
# XXX: errno is supposed to be set here
|
# XXX: errno is supposed to be set here
|
||||||
# Is there an exception that wraps it?
|
# Is there an exception that wraps it?
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue