Module Name: src
Committed By: christos
Date: Thu Jun 26 20:14:32 UTC 2014
Modified Files:
src/lib/libc/gen: getcap.c
Log Message:
don't depend on expandtc to open the database or not.
To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/lib/libc/gen/getcap.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/gen/getcap.c
diff -u src/lib/libc/gen/getcap.c:1.52 src/lib/libc/gen/getcap.c:1.53
--- src/lib/libc/gen/getcap.c:1.52 Mon Jun 4 16:56:40 2012
+++ src/lib/libc/gen/getcap.c Thu Jun 26 16:14:32 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: getcap.c,v 1.52 2012/06/04 20:56:40 joerg Exp $ */
+/* $NetBSD: getcap.c,v 1.53 2014/06/26 20:14:32 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)getcap.c 8.3 (Berkeley) 3/25/94";
#else
-__RCSID("$NetBSD: getcap.c,v 1.52 2012/06/04 20:56:40 joerg Exp $");
+__RCSID("$NetBSD: getcap.c,v 1.53 2014/06/26 20:14:32 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -254,13 +254,6 @@ static int
getent(char **cap, size_t *len, const char * const *db_array, int fd,
const char *name, int depth, char *nfield)
{
-#ifndef SMALL
- DB *capdbp;
- char pbuf[MAXPATHLEN];
- char *cbuf;
- int retval;
- size_t clen;
-#endif
char *record, *newrecord;
char *r_end, *rp; /* pacify gcc */
const char * const *db_p;
@@ -322,9 +315,14 @@ getent(char **cap, size_t *len, const ch
(void)lseek(fd, (off_t)0, SEEK_SET);
} else {
#ifndef SMALL
+ DB *capdbp;
+ char pbuf[MAXPATHLEN];
+ char *cbuf;
+ int retval;
+ size_t clen;
+
(void)snprintf(pbuf, sizeof(pbuf), "%s.db", *db_p);
- if (expandtc &&
- (capdbp = dbopen(pbuf, O_RDONLY, 0, DB_HASH, 0))
+ if ((capdbp = dbopen(pbuf, O_RDONLY, 0, DB_HASH, 0))
!= NULL) {
free(record);
retval = cdbget(capdbp, &record, name);