rktio: make append mode imply can-exist on Windows

This commit is contained in:
Matthew Flatt 2017-06-18 10:05:16 -06:00
parent a13bfd25d0
commit b96fc45133
2 changed files with 2 additions and 1 deletions

View File

@ -114,6 +114,7 @@ typedef struct rktio_fd_t rktio_fd_t;
#define RKTIO_OPEN_APPEND (1<<4)
#define RKTIO_OPEN_MUST_EXIST (1<<5)
#define RKTIO_OPEN_CAN_EXIST (1<<6)
/* `RKTIO_OPEN_APPEND` implies `RKTIO_OPEN_CAN_EXIST` */
/* Used for `rktio_system_fd`: */
#define RKTIO_OPEN_SOCKET (1<<7)

View File

@ -172,7 +172,7 @@ static rktio_fd_t *open_write(rktio_t *rktio, const char *filename, int modes)
hmode = TRUNCATE_EXISTING;
else
hmode = OPEN_EXISTING;
} else if (modes & RKTIO_OPEN_CAN_EXIST)
} else if (modes & (RKTIO_OPEN_CAN_EXIST | RKTIO_OPEN_APPEND))
hmode = OPEN_ALWAYS;
else
hmode = CREATE_NEW;