From 049073f5980e4926e21fe0d983ef4faa5405fb87 Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Sat, 13 Nov 1999 04:17:44 +0000 Subject: [PATCH] make sure to use db only if we have both the library and the header file git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7375 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/roken/getcap.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/roken/getcap.c b/lib/roken/getcap.c index dae9ab108..fa5604802 100644 --- a/lib/roken/getcap.c +++ b/lib/roken/getcap.c @@ -73,7 +73,11 @@ static size_t topreclen; /* toprec length */ static char *toprec; /* Additional record specified by cgetset() */ static int gottoprec; /* Flag indicating retrieval of toprecord */ -#ifdef HAVE_DBOPEN +#if defined(HAVE_DBOPEN) && defined(HAVE_DB_H) +#define USE_DB +#endif + +#if USE_DB static int cdbget (DB *, char **, const char *); #endif static int getent (char **, size_t *, char **, int, const char *, int, char *); @@ -280,7 +284,7 @@ getent(char **cap, size_t *len, char **db_array, int fd, if (fd >= 0) { (void)lseek(fd, (off_t)0, SEEK_SET); } else { -#ifdef HAVE_DBOPEN +#if USE_DB char pbuf[_POSIX_PATH_MAX]; char *cbuf; size_t clen; @@ -607,7 +611,7 @@ getent(char **cap, size_t *len, char **db_array, int fd, return (0); } -#ifdef HAVE_DBOPEN +#if USE_DB static int cdbget(DB *capdbp, char **bp, const char *name) { @@ -638,7 +642,7 @@ cdbget(DB *capdbp, char **bp, const char *name) *bp = (char *)data.data + 1; return (((char *)(data.data))[0] == TCERR ? 1 : 0); } -#endif /* HAVE_DBOPEN */ +#endif /* USE_DB */ /* * Cgetmatch will return 0 if name is one of the names of the capability