mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-03-02 23:18:44 +00:00
Make redbean unix.open default to O_RDONLY
This commit is contained in:
parent
ec6e0fa5f4
commit
0f6251f4d2
2 changed files with 3 additions and 3 deletions
|
@ -1493,7 +1493,7 @@ UNIX MODULE
|
|||
|
||||
`flags` should have one of:
|
||||
|
||||
- `O_RDONLY`: open for reading
|
||||
- `O_RDONLY`: open for reading (default)
|
||||
- `O_WRONLY`: open for writing
|
||||
- `O_RDWR`: open for reading and writing
|
||||
|
||||
|
|
|
@ -850,7 +850,7 @@ static int LuaUnixFdatasync(lua_State *L) {
|
|||
return SysretBool(L, "fdatasync", olderr, fdatasync(luaL_checkinteger(L, 1)));
|
||||
}
|
||||
|
||||
// unix.open(path:str, flags:int[, mode:int[, dirfd:int]])
|
||||
// unix.open(path:str[, flags:int[, mode:int[, dirfd:int]]])
|
||||
// ├─→ fd:int
|
||||
// └─→ nil, unix.Errno
|
||||
static int LuaUnixOpen(lua_State *L) {
|
||||
|
@ -858,7 +858,7 @@ static int LuaUnixOpen(lua_State *L) {
|
|||
return SysretInteger(
|
||||
L, "open", olderr,
|
||||
openat(luaL_optinteger(L, 4, AT_FDCWD), luaL_checkstring(L, 1),
|
||||
luaL_checkinteger(L, 2), luaL_optinteger(L, 3, 0)));
|
||||
luaL_optinteger(L, 2, O_RDONLY), luaL_optinteger(L, 3, 0)));
|
||||
}
|
||||
|
||||
// unix.close(fd:int)
|
||||
|
|
Loading…
Add table
Reference in a new issue