diff options
-rw-r--r-- | lib/libc/db/hash/ndbm.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/libc/db/hash/ndbm.c b/lib/libc/db/hash/ndbm.c index 2d54848ad78..73e9274b440 100644 --- a/lib/libc/db/hash/ndbm.c +++ b/lib/libc/db/hash/ndbm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ndbm.c,v 1.11 1999/04/18 17:08:07 millert Exp $ */ +/* $OpenBSD: ndbm.c,v 1.12 2000/08/01 21:26:10 millert Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -40,7 +40,7 @@ #if 0 static char sccsid[] = "@(#)dbm.c 8.6 (Berkeley) 11/7/95"; #else -static char rcsid[] = "$OpenBSD: ndbm.c,v 1.11 1999/04/18 17:08:07 millert Exp $"; +static char rcsid[] = "$OpenBSD: ndbm.c,v 1.12 2000/08/01 21:26:10 millert Exp $"; #endif #endif /* LIBC_SCCS and not lint */ @@ -204,6 +204,11 @@ _dbm_open(file, suff, flags, mode) errno = ENAMETOOLONG; return (NULL); } + /* O_WRONLY not supported by db(3) but traditional ndbm allowed it. */ + if ((flags & O_ACCMODE) == O_WRONLY) { + flags &= ~O_WRONLY; + flags |= O_RDWR; + } info.bsize = 4096; info.ffactor = 40; info.nelem = 1; |