io: add O_CREAT to flags with ACCESS_WRITE

This commit is contained in:
Danny Robson 2014-12-30 18:37:04 +11:00
parent 0ea3d5b9ac
commit debdd77610

4
io.cpp
View File

@ -43,11 +43,11 @@ access_to_cflags (access_t a) {
int flags = 0; int flags = 0;
if ((a & ACCESS_READWRITE) == ACCESS_READWRITE) { if ((a & ACCESS_READWRITE) == ACCESS_READWRITE) {
flags = O_RDWR; flags = O_RDWR | O_CREAT;
} else if (a & ACCESS_READ) { } else if (a & ACCESS_READ) {
flags = O_RDONLY; flags = O_RDONLY;
} else if (a & ACCESS_WRITE) { } else if (a & ACCESS_WRITE) {
flags = O_WRONLY; flags = O_WRONLY | O_CREAT;
} }
a = static_cast<access_t> (a & ~ACCESS_READWRITE); a = static_cast<access_t> (a & ~ACCESS_READWRITE);