TDB: quieten compiler and testsuite
[exim.git] / src / src / lookups / dbmdb.c
index cac8008e5959e178891c4a0c0646f94debc58cc3..6db6dedb89e4efad3a2f48e832f889123faa40e7 100644 (file)
@@ -3,6 +3,7 @@
 *************************************************/
 
 /* Copyright (c) University of Cambridge 1995 - 2018 */
+/* Copyright (c) The Exim Maintainers 2020 - 2021 */
 /* See the file NOTICE for conditions of use and distribution. */
 
 #include "../exim.h"
@@ -25,11 +26,7 @@ EXIM_DB *yield = NULL;
 if ((s = Ustrrchr(dirname, '/'))) *s = '\0';
 EXIM_DBOPEN(filename, dirname, O_RDONLY, 0, &yield);
 if (!yield)
-  {
-  int save_errno = errno;
-  *errmsg = string_open_failed(errno, "%s as a %s file", filename, EXIM_DBTYPE);
-  errno = save_errno;
-  }
+  *errmsg = string_open_failed("%s as a %s file", filename, EXIM_DBTYPE);
 return yield;
 }
 
@@ -51,7 +48,6 @@ dbmdb_check(void *handle, const uschar *filename, int modemask, uid_t *owners,
   gid_t *owngroups, uschar **errmsg)
 {
 int rc;
-handle = handle;    /* Keep picky compilers happy */
 
 #if defined(USE_DB) || defined(USE_TDB) || defined(USE_GDBM)
 rc = lf_check_file(-1, filename, S_IFREG, modemask, owners, owngroups,
@@ -97,13 +93,9 @@ dbmdb_find(void * handle, const uschar * filename, const uschar * keystring,
 EXIM_DB *d = (EXIM_DB *)handle;
 EXIM_DATUM key, data;
 
-filename = filename;    /* Keep picky compilers happy */
-errmsg = errmsg;
-do_cache = do_cache;
-
 EXIM_DATUM_INIT(key);               /* Some DBM libraries require datums to */
 EXIM_DATUM_INIT(data);              /* be cleared before use. */
-EXIM_DATUM_DATA(key) = CS keystring;
+EXIM_DATUM_DATA(key) = (void *) keystring;
 EXIM_DATUM_SIZE(key) = length + 1;
 
 if (EXIM_DBGET(d, key, data))
@@ -157,7 +149,7 @@ int buflen, bufleft, key_item_len, sep = 0;
 or less than, the length of the delimited list passed in + 1. */
 
 buflen = length + 3;
-key_buffer = store_get(buflen, is_tainted(keystring));
+key_buffer = store_get(buflen, keystring);
 
 key_buffer[0] = '\0';
 
@@ -235,12 +227,13 @@ EXIM_DBCLOSE((EXIM_DB *)handle);
 
 #include "../version.h"
 
-void
-dbm_version_report(FILE *f)
+gstring *
+dbm_version_report(gstring * g)
 {
 #ifdef DYNLOOKUP
-fprintf(f, "Library version: DBM: Exim version %s\n", EXIM_VERSION_STR);
+g = string_fmt_append(g, "Library version: DBM: Exim version %s\n", EXIM_VERSION_STR);
 #endif
+return g;
 }