From: deraadt Date: Mon, 22 Jan 2024 17:22:58 +0000 (+0000) Subject: Similar to getpwnam(3) and getnetgrent(3), it is better to call X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=68465c52de160eb2ce540eed5547b4a109987dcc;p=openbsd 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 --- 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;