diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2005-12-14 16:38:22 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2005-12-14 16:38:22 +0000 |
commit | ba31e832be0bba89d8848aaea6e6eebbe7c56355 (patch) | |
tree | bf1d14a289bc179027fb597a8ee04174f1ab7015 /winsup/cygwin/fhandler.cc | |
parent | e3d14af155fb84890a32fad7f7706967ac5bc7d9 (diff) | |
download | cygnal-ba31e832be0bba89d8848aaea6e6eebbe7c56355.tar.gz cygnal-ba31e832be0bba89d8848aaea6e6eebbe7c56355.tar.bz2 cygnal-ba31e832be0bba89d8848aaea6e6eebbe7c56355.zip |
* fhandler.cc (ACCFLAGS): Remove macro.
(fhandler_base::get_default_fmode): Use O_ACCMODE instead of ACCFLAGS
and or'ed read/write flags.
(fhandler_base::open_9x): Use O_ACCMODE instead of or'ed read/write
flags.
(fhandler_base::open): Ditto.
* fhandler_disk_file.cc (fhandler_base::open_fs): Ditto.
* fhandler_mem.cc (fhandler_dev_mem::open): Ditto.
* fhandler_raw.cc (fhandler_dev_raw::open): Ditto.
Diffstat (limited to 'winsup/cygwin/fhandler.cc')
-rw-r--r-- | winsup/cygwin/fhandler.cc | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index 0a119c845..e1686e1cf 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -298,7 +298,6 @@ written: return bytes_written; } -#define ACCFLAGS(x) (x & (O_RDONLY | O_WRONLY | O_RDWR)) int fhandler_base::get_default_fmode (int flags) { @@ -306,11 +305,11 @@ fhandler_base::get_default_fmode (int flags) if (perfile_table) { size_t nlen = strlen (get_name ()); - unsigned accflags = ACCFLAGS (flags); + unsigned accflags = (flags & O_ACCMODE); for (__cygwin_perfile *pf = perfile_table; pf->name; pf++) - if (!*pf->name && ACCFLAGS (pf->flags) == accflags) + if (!*pf->name && (pf->flags & O_ACCMODE) == accflags) { - fmode = pf->flags & ~(O_RDONLY | O_WRONLY | O_RDWR); + fmode = pf->flags & ~O_ACCMODE; break; } else @@ -319,9 +318,10 @@ fhandler_base::get_default_fmode (int flags) const char *stem = get_name () + nlen - pflen; if (pflen > nlen || (stem != get_name () && !isdirsep (stem[-1]))) continue; - else if (ACCFLAGS (pf->flags) == accflags && strcasematch (stem, pf->name)) + else if ((pf->flags & O_ACCMODE) == accflags + && strcasematch (stem, pf->name)) { - fmode = pf->flags & ~(O_RDONLY | O_WRONLY | O_RDWR); + fmode = pf->flags & ~O_ACCMODE; break; } } @@ -459,9 +459,9 @@ fhandler_base::open_9x (int flags, mode_t mode) access = GENERIC_READ | FILE_WRITE_ATTRIBUTES; break; default: - if ((flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_RDONLY) + if ((flags & O_ACCMODE) == O_RDONLY) access = GENERIC_READ; - else if ((flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_WRONLY) + else if ((flags & O_ACCMODE) == O_WRONLY) access = GENERIC_WRITE; else access = GENERIC_READ | GENERIC_WRITE; @@ -524,7 +524,7 @@ fhandler_base::open_9x (int flags, mode_t mode) { if (pc.isdir ()) { - if (flags & (O_WRONLY | O_RDWR)) + if ((flags & O_ACCMODE) != O_RDONLY) set_errno (EISDIR); else nohandle (true); @@ -603,9 +603,9 @@ fhandler_base::open (int flags, mode_t mode) break; default: create_options = 0; - if ((flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_RDONLY) + if ((flags & O_ACCMODE) == O_RDONLY) access = GENERIC_READ; - else if ((flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_WRONLY) + else if ((flags & O_ACCMODE) == O_WRONLY) access = GENERIC_WRITE | FILE_READ_ATTRIBUTES; else access = GENERIC_READ | GENERIC_WRITE; |