summaryrefslogtreecommitdiff
path: root/lib/libc/gen
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2024-01-22 17:22:59 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2024-01-22 17:22:59 +0000
commitb56e3fb80a5b9275952636ac4605a5353fad588a (patch)
tree8e47caac7d6bb44945d4d46f580d7d5176bd527a /lib/libc/gen
parent3713c8c2fbb76843ab064f15a5998fbe5e4c0b38 (diff)
Similar to getpwnam(3) and getnetgrent(3), it is better to call
libc-private __hash_open() than the generic dbopen(3) which pulls in all 3 database backends. ok millert
Diffstat (limited to 'lib/libc/gen')
-rw-r--r--lib/libc/gen/devname.c4
-rw-r--r--lib/libc/gen/getcap.c4
-rw-r--r--lib/libc/gen/ttyname.c4
3 files changed, 6 insertions, 6 deletions
diff --git a/lib/libc/gen/devname.c b/lib/libc/gen/devname.c
index 890f10b32ed..ab4ee64a3b6 100644
--- a/lib/libc/gen/devname.c
+++ b/lib/libc/gen/devname.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: devname.c,v 1.13 2016/07/06 04:35:12 guenther Exp $ */
+/* $OpenBSD: devname.c,v 1.14 2024/01/22 17:22:58 deraadt Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -83,7 +83,7 @@ devname(dev_t dev, mode_t type)
char *name = NULL;
if (!db && !failure) {
- if (!(db = dbopen(_PATH_DEVDB, O_RDONLY, 0, DB_HASH, NULL)))
+ if (!(db = __hash_open(_PATH_DEVDB, O_RDONLY, 0, NULL, 0)))
failure = true;
}
if (!failure) {
diff --git a/lib/libc/gen/getcap.c b/lib/libc/gen/getcap.c
index 5af3c40d04d..70f5c99fc3e 100644
--- a/lib/libc/gen/getcap.c
+++ b/lib/libc/gen/getcap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getcap.c,v 1.36 2022/05/14 05:06:32 guenther Exp $ */
+/* $OpenBSD: getcap.c,v 1.37 2024/01/22 17:22:58 deraadt Exp $ */
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -252,7 +252,7 @@ getent(char **cap, u_int *len, char **db_array, FILE *fp,
clen = snprintf(pbuf, sizeof(pbuf), "%s.db", *db_p);
if (clen >= 0 && clen < sizeof(pbuf) && usedb &&
- (capdbp = dbopen(pbuf, O_RDONLY, 0, DB_HASH, 0))) {
+ (capdbp = __hash_open(pbuf, O_RDONLY, 0, NULL, 0))) {
opened++;
retval = cdbget(capdbp, &dbrecord, name);
if (retval < 0) {
diff --git a/lib/libc/gen/ttyname.c b/lib/libc/gen/ttyname.c
index 0ceb9752049..6b61ccee001 100644
--- a/lib/libc/gen/ttyname.c
+++ b/lib/libc/gen/ttyname.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ttyname.c,v 1.20 2017/04/14 15:02:51 deraadt Exp $ */
+/* $OpenBSD: ttyname.c,v 1.21 2024/01/22 17:22:58 deraadt Exp $ */
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -87,7 +87,7 @@ ttyname_r(int fd, char *buf, size_t len)
memcpy(buf, _PATH_DEV, sizeof(_PATH_DEV));
- if ((db = dbopen(_PATH_DEVDB, O_RDONLY, 0, DB_HASH, NULL))) {
+ if ((db = __hash_open(_PATH_DEVDB, O_RDONLY, 0, NULL, 0))) {
memset(&bkey, 0, sizeof(bkey));
bkey.type = S_IFCHR;
bkey.dev = sb.st_rdev;