Return EINVAL for meaningless combination of MU_STREAM_READ + WRITE.
Showing
3 changed files
with
11 additions
and
2 deletions
... | @@ -244,7 +244,9 @@ _file_open (stream_t stream, const char *filename, int port, int flags) | ... | @@ -244,7 +244,9 @@ _file_open (stream_t stream, const char *filename, int port, int flags) |
244 | } | 244 | } |
245 | 245 | ||
246 | /* Map the flags to the system equivalent. */ | 246 | /* Map the flags to the system equivalent. */ |
247 | if (flags & MU_STREAM_WRITE) | 247 | if (flags & MU_STREAM_WRITE && flags & MU_STREAM_READ) |
248 | return EINVAL; | ||
249 | else if (flags & MU_STREAM_WRITE) | ||
248 | flg = O_WRONLY; | 250 | flg = O_WRONLY; |
249 | else if (flags & MU_STREAM_RDWR) | 251 | else if (flags & MU_STREAM_RDWR) |
250 | flg = O_RDWR; | 252 | flg = O_RDWR; | ... | ... |
... | @@ -279,7 +279,9 @@ _mapfile_open (stream_t stream, const char *filename, int port, int flags) | ... | @@ -279,7 +279,9 @@ _mapfile_open (stream_t stream, const char *filename, int port, int flags) |
279 | mfs->fd = -1; | 279 | mfs->fd = -1; |
280 | } | 280 | } |
281 | /* Map the flags to the system equivalent */ | 281 | /* Map the flags to the system equivalent */ |
282 | if (flags & MU_STREAM_WRITE) | 282 | if (flags & MU_STREAM_WRITE && flags & MU_STREAM_READ) |
283 | return EINVAL; | ||
284 | else if (flags & MU_STREAM_WRITE) | ||
283 | { | 285 | { |
284 | mflag = PROT_WRITE; | 286 | mflag = PROT_WRITE; |
285 | flg = O_WRONLY; | 287 | flg = O_WRONLY; | ... | ... |
-
Please register or sign in to post a comment