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:
boydgreenfield
2014-05-05 16:42:30 -07:00
parent c210e1255c
commit a309a5f38a

View File

@@ -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?