git://git.exim.org
/
exim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Move errno-protection into string_open_failed()
[exim.git]
/
src
/
src
/
lookups
/
cdb.c
diff --git
a/src/src/lookups/cdb.c
b/src/src/lookups/cdb.c
index 15c88420449c5bb789a4475fe1eb2312895d3b65..c0ac2cbe45e360c902b4745386b8c7e305decb99 100644
(file)
--- 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) 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
*
* 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)
{
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)
{
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);
filename);
- errno = save_errno;
return NULL;
}
return NULL;
}
@@
-177,11
+173,7
@@
CDB_HASH_TABLE bytes long */
if (statbuf.st_size < CDB_HASH_TABLE)
{
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;
}
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 */
/* 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;
filename);
cdb_close(cdbp);
return NULL;
@@
-280,9
+271,6
@@
hash_offset,
hash_offlen,
hash_slotnm;
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);
key_hash = cdb_hash(keystring, key_len);
hash_offset_entry = CDB_HASH_ENTRY * (key_hash & CDB_HASH_MASK);