Commit fcc8b0cb fcc8b0cbf626c629cb85fa83fbad61d25380c378 by Sam Roberts

Return EINVAL for meaningless combination of MU_STREAM_READ + WRITE.

1 parent 7481f59a
1 2001-06-03 Sam Roberts
2
3 * mailbox/file_stream.c,mailbox/mapfile_stream.c: Return EINVAL
4 for meaningless combination of MU_STREAM_READ + WRITE.
5
1 2001-06-03 Alain Magloire 6 2001-06-03 Alain Magloire
2 7
3 * doc/*; Bunch of typos corrected. 8 * doc/*; Bunch of typos corrected.
......
...@@ -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;
......