Skip to content

Commit 68465c5

Browse files
author
deraadt
committed
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
1 parent 5f5ca73 commit 68465c5

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

lib/libc/gen/devname.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: devname.c,v 1.13 2016/07/06 04:35:12 guenther Exp $ */
1+
/* $OpenBSD: devname.c,v 1.14 2024/01/22 17:22:58 deraadt Exp $ */
22
/*
33
* Copyright (c) 1989, 1993
44
* The Regents of the University of California. All rights reserved.
@@ -83,7 +83,7 @@ devname(dev_t dev, mode_t type)
8383
char *name = NULL;
8484

8585
if (!db && !failure) {
86-
if (!(db = dbopen(_PATH_DEVDB, O_RDONLY, 0, DB_HASH, NULL)))
86+
if (!(db = __hash_open(_PATH_DEVDB, O_RDONLY, 0, NULL, 0)))
8787
failure = true;
8888
}
8989
if (!failure) {

lib/libc/gen/getcap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: getcap.c,v 1.36 2022/05/14 05:06:32 guenther Exp $ */
1+
/* $OpenBSD: getcap.c,v 1.37 2024/01/22 17:22:58 deraadt Exp $ */
22
/*-
33
* Copyright (c) 1992, 1993
44
* 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,
252252

253253
clen = snprintf(pbuf, sizeof(pbuf), "%s.db", *db_p);
254254
if (clen >= 0 && clen < sizeof(pbuf) && usedb &&
255-
(capdbp = dbopen(pbuf, O_RDONLY, 0, DB_HASH, 0))) {
255+
(capdbp = __hash_open(pbuf, O_RDONLY, 0, NULL, 0))) {
256256
opened++;
257257
retval = cdbget(capdbp, &dbrecord, name);
258258
if (retval < 0) {

lib/libc/gen/ttyname.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: ttyname.c,v 1.20 2017/04/14 15:02:51 deraadt Exp $ */
1+
/* $OpenBSD: ttyname.c,v 1.21 2024/01/22 17:22:58 deraadt Exp $ */
22
/*
33
* Copyright (c) 1988, 1993
44
* The Regents of the University of California. All rights reserved.
@@ -87,7 +87,7 @@ ttyname_r(int fd, char *buf, size_t len)
8787

8888
memcpy(buf, _PATH_DEV, sizeof(_PATH_DEV));
8989

90-
if ((db = dbopen(_PATH_DEVDB, O_RDONLY, 0, DB_HASH, NULL))) {
90+
if ((db = __hash_open(_PATH_DEVDB, O_RDONLY, 0, NULL, 0))) {
9191
memset(&bkey, 0, sizeof(bkey));
9292
bkey.type = S_IFCHR;
9393
bkey.dev = sb.st_rdev;

0 commit comments

Comments
 (0)