diff options
author | Roland McGrath <roland@gnu.org> | 1999-06-08 09:07:31 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1999-06-08 09:07:31 +0000 |
commit | 8a0e55c3ee831ef5d3599ddb9f94bc55fca5f93d (patch) | |
tree | 7aa8dd020598639d9aa3b53eaed7b7afd5e0f6d8 /db2 | |
parent | 54fe45dc7c6c5e16d4f4ba600868e17c942aa6ed (diff) | |
download | glibc-8a0e55c3ee831ef5d3599ddb9f94bc55fca5f93d.tar.gz glibc-8a0e55c3ee831ef5d3599ddb9f94bc55fca5f93d.tar.xz glibc-8a0e55c3ee831ef5d3599ddb9f94bc55fca5f93d.zip |
1999-06-07 Roland McGrath <roland@baalperazim.frob.com>
* db2/os/os_oflags.c (__db_oflags): Fix checking of O_ACCMODE bits to be POSIX compliant. Prior definition was broken for Hurd. Reported by Mark Kettenis <kettenis@gnu.org>.
Diffstat (limited to 'db2')
-rw-r--r-- | db2/os/os_oflags.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/db2/os/os_oflags.c b/db2/os/os_oflags.c index 388c1c6faa..976b84d709 100644 --- a/db2/os/os_oflags.c +++ b/db2/os/os_oflags.c @@ -33,16 +33,21 @@ __db_oflags(oflags) u_int32_t dbflags; /* - * XXX - * Convert POSIX 1003.1 open(2) flags to DB flags. Not an exact - * science as most POSIX implementations don't have a flag value - * for O_RDONLY, it's simply the lack of a write flag. + * Convert POSIX 1003.1 open(2) flags to DB flags. */ dbflags = 0; + switch (oflags & O_ACCMODE) { + case O_RDONLY: + dbflags |= DB_RDONLY; + break; + case O_WRONLY: + case O_RDWR: + break; + default: /* Bogus flags value from user. */ + /* XXX no way to return error from here */ + } if (oflags & O_CREAT) dbflags |= DB_CREATE; - if (!(oflags & (O_RDWR | O_WRONLY)) || oflags & O_RDONLY) - dbflags |= DB_RDONLY; if (oflags & O_TRUNC) dbflags |= DB_TRUNCATE; return (dbflags); |