X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsrc%2Flookups%2Fcdb.c;h=c0ac2cbe45e360c902b4745386b8c7e305decb99;hb=fd5ad03aa7da47965ce3e23294661c8f3c602d33;hp=c9a5de1d81554188a8eab4b5c5bc61d2077f7679;hpb=d447dbd160a0fb503ed1e763f3f23d28744b6ddd;p=user%2Fhenk%2Fcode%2Fexim.git diff --git a/src/src/lookups/cdb.c b/src/src/lookups/cdb.c index c9a5de1d8..c0ac2cbe4 100644 --- a/src/src/lookups/cdb.c +++ b/src/src/lookups/cdb.c @@ -7,6 +7,7 @@ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * Copyright (c) 1998 Nigel Metheringham, Planet Online Ltd + * Copyright (c) The Exim Maintainers 2020 * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -156,19 +157,14 @@ void * mapbuf; if ((fileno = Uopen(filename, O_RDONLY, 0)) < 0) { - int save_errno = errno; - *errmsg = string_open_failed(errno, "%s for cdb lookup", filename); - errno = save_errno; + *errmsg = string_open_failed("%s for cdb lookup", filename); return NULL; } if (fstat(fileno, &statbuf) != 0) { - int save_errno = errno; - *errmsg = string_open_failed(errno, - "fstat(%s) failed - cannot do cdb lookup", + *errmsg = string_open_failed("fstat(%s) failed - cannot do cdb lookup", filename); - errno = save_errno; return NULL; } @@ -177,11 +173,7 @@ CDB_HASH_TABLE bytes long */ if (statbuf.st_size < CDB_HASH_TABLE) { - int save_errno = errno; - *errmsg = string_open_failed(errno, - "%s too short for cdb lookup", - filename); - errno = save_errno; + *errmsg = string_open_failed("%s too short for cdb lookup", filename); return NULL; } @@ -230,8 +222,7 @@ if (cdb_bread(fileno, cdbp->cdb_offsets, CDB_HASH_TABLE) == -1) /* read of hash table failed, oh dear, oh..... time to give up I think.... call the close routine (deallocs the memory), and return NULL */ - *errmsg = string_open_failed(errno, - "cannot read header from %s for cdb lookup", + *errmsg = string_open_failed("cannot read header from %s for cdb lookup", filename); cdb_close(cdbp); return NULL; @@ -264,7 +255,8 @@ return lf_check_file(cdbp->fileno, filename, S_IFREG, modemask, static int cdb_find(void * handle, const uschar * filename, const uschar * keystring, - int key_len, uschar ** result, uschar ** errmsg, uint * do_cache) + int key_len, uschar ** result, uschar ** errmsg, uint * do_cache, + const uschar * opts) { struct cdb_state * cdbp = handle; uint32 item_key_len, @@ -279,9 +271,6 @@ hash_offset, hash_offlen, hash_slotnm; -/* Keep picky compilers happy */ -do_cache = do_cache; - key_hash = cdb_hash(keystring, key_len); hash_offset_entry = CDB_HASH_ENTRY * (key_hash & CDB_HASH_MASK); @@ -479,15 +468,15 @@ fprintf(f, "Library version: CDB: Exim version %s\n", EXIM_VERSION_STR); lookup_info cdb_lookup_info = { - US"cdb", /* lookup name */ - lookup_absfile, /* uses absolute file name */ - cdb_open, /* open function */ - cdb_check, /* check function */ - cdb_find, /* find function */ - cdb_close, /* close function */ - NULL, /* no tidy function */ - NULL, /* no quoting function */ - cdb_version_report /* version reporting */ + .name = US"cdb", /* lookup name */ + .type = lookup_absfile, /* absolute file name */ + .open = cdb_open, /* open function */ + .check = cdb_check, /* check function */ + .find = cdb_find, /* find function */ + .close = cdb_close, /* close function */ + .tidy = NULL, /* no tidy function */ + .quote = NULL, /* no quoting function */ + .version_report = cdb_version_report /* version reporting */ }; #ifdef DYNLOOKUP