diff --git a/mongoose.c b/mongoose.c index 371afade..4aff7d72 100644 --- a/mongoose.c +++ b/mongoose.c @@ -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 diff --git a/src/fs_posix.c b/src/fs_posix.c index e5c55f09..308a62e2 100644 --- a/src/fs_posix.c +++ b/src/fs_posix.c @@ -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