diff options
author | 2001-01-03 15:24:09 +0000 | |
---|---|---|
committer | 2001-01-03 15:24:09 +0000 | |
commit | e8aa8cc6153872baf74de273592ad1f4604f962e (patch) | |
tree | 83b11a6fe02608d7c5e1c18c04fd37485caff713 | |
parent | Adding misc files. (diff) | |
download | wireguard-openbsd-e8aa8cc6153872baf74de273592ad1f4604f962e.tar.xz wireguard-openbsd-e8aa8cc6153872baf74de273592ad1f4604f962e.zip |
Make it an error to open a zero-length file for read-only access.
This makes cap_mkdb happier, though cap_mkdb still behaves incorrectly
when given multiple files (but that is cap_mkdb's fault).
-rw-r--r-- | lib/libc/db/hash/hash.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/db/hash/hash.c b/lib/libc/db/hash/hash.c index f3635ed7772..cd550fd06a3 100644 --- a/lib/libc/db/hash/hash.c +++ b/lib/libc/db/hash/hash.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hash.c,v 1.8 1999/04/18 17:08:07 millert Exp $ */ +/* $OpenBSD: hash.c,v 1.9 2001/01/03 15:24:09 millert Exp $ */ /*- * Copyright (c) 1990, 1993, 1994 @@ -40,7 +40,7 @@ #if 0 static char sccsid[] = "@(#)hash.c 8.9 (Berkeley) 6/16/94"; #else -static char rcsid[] = "$OpenBSD: hash.c,v 1.8 1999/04/18 17:08:07 millert Exp $"; +static char rcsid[] = "$OpenBSD: hash.c,v 1.9 2001/01/03 15:24:09 millert Exp $"; #endif #endif /* LIBC_SCCS and not lint */ @@ -130,7 +130,7 @@ __hash_open(file, flags, mode, info, dflags) new_table = 0; if (!file || (flags & O_TRUNC) || ((rv = stat(file, &statbuf)) && errno == ENOENT) || - (rv == 0 && statbuf.st_size == 0)) { + (rv == 0 && !statbuf.st_size && (flags & O_ACCMODE) != O_RDONLY)) { if (errno == ENOENT) errno = 0; /* Just in case someone looks at errno */ new_table = 1; |