Fix posix_open()

This commit is contained in:
Sergey Lyubka 2021-09-02 10:20:55 +01:00
parent 5bf5516b29
commit acf58972f7
2 changed files with 8 additions and 8 deletions

View File

@ -679,10 +679,10 @@ static void posix_list(const char *dir, void (*fn)(const char *, void *),
}
static struct mg_fd *posix_open(const char *path, int flags) {
const char *mode =
flags & (MG_FS_READ | MG_FS_WRITE)
? "r+b"
: flags & MG_FS_READ ? "rb" : flags & MG_FS_WRITE ? "wb" : "";
const char *mode = flags == (MG_FS_READ | MG_FS_WRITE) ? "r+b"
: flags & MG_FS_READ ? "rb"
: flags & MG_FS_WRITE ? "wb"
: "";
void *fp = NULL;
struct mg_fd *fd = NULL;
#ifdef _WIN32

View File

@ -155,10 +155,10 @@ static void posix_list(const char *dir, void (*fn)(const char *, void *),
}
static struct mg_fd *posix_open(const char *path, int flags) {
const char *mode =
flags & (MG_FS_READ | MG_FS_WRITE)
? "r+b"
: flags & MG_FS_READ ? "rb" : flags & MG_FS_WRITE ? "wb" : "";
const char *mode = flags == (MG_FS_READ | MG_FS_WRITE) ? "r+b"
: flags & MG_FS_READ ? "rb"
: flags & MG_FS_WRITE ? "wb"
: "";
void *fp = NULL;
struct mg_fd *fd = NULL;
#ifdef _WIN32