use O_ACCMODE to extract O_WRONLY bit
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Tue, 3 Nov 1992 01:16:45 +0000 (17:16 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Tue, 3 Nov 1992 01:16:45 +0000 (17:16 -0800)
SCCS-vsn: lib/libc/db/hash/hash.c 5.27

usr/src/lib/libc/db/hash/hash.c

index fd2d568..32773a0 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)hash.c     5.26 (Berkeley) %G%";
+static char sccsid[] = "@(#)hash.c     5.27 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/param.h>
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/param.h>
@@ -77,7 +77,7 @@ __hash_open(file, flags, mode, info)
        DB *dbp;
        int bpages, hdrsize, new_table, nsegs, save_errno;
 
        DB *dbp;
        int bpages, hdrsize, new_table, nsegs, save_errno;
 
-       if (flags & O_WRONLY) {
+       if ((flags & O_ACCMODE) == O_WRONLY) {
                errno = EINVAL;
                return (NULL);
        }
                errno = EINVAL;
                return (NULL);
        }