cache: use size_t for string lengths

Avoid integer truncation on 64-bit systems.

Coverity-id: 13864
Signed-off-by: John Keeping <john@keeping.me.uk>
This commit is contained in:
John Keeping 2016-01-16 11:03:06 +00:00 committed by Jason A. Donenfeld
parent baa5ad1f80
commit 3fbfced740

View File

@ -24,7 +24,7 @@
struct cache_slot { struct cache_slot {
const char *key; const char *key;
int keylen; size_t keylen;
int ttl; int ttl;
cache_fill_fn fn; cache_fill_fn fn;
int cache_fd; int cache_fd;
@ -44,7 +44,7 @@ struct cache_slot {
static int open_slot(struct cache_slot *slot) static int open_slot(struct cache_slot *slot)
{ {
char *bufz; char *bufz;
int bufkeylen = -1; ssize_t bufkeylen = -1;
slot->cache_fd = open(slot->cache_name, O_RDONLY); slot->cache_fd = open(slot->cache_name, O_RDONLY);
if (slot->cache_fd == -1) if (slot->cache_fd == -1)