]> granicus.if.org Git - cgit/commitdiff
cache: use size_t for string lengths
authorJohn Keeping <john@keeping.me.uk>
Sat, 16 Jan 2016 11:03:06 +0000 (11:03 +0000)
committerJason A. Donenfeld <Jason@zx2c4.com>
Sun, 17 Jan 2016 16:05:19 +0000 (17:05 +0100)
Avoid integer truncation on 64-bit systems.

Coverity-id: 13864
Signed-off-by: John Keeping <john@keeping.me.uk>
cache.c

diff --git a/cache.c b/cache.c
index b169d20f779aaa21ed5c3bd8e4e21c62500a0c90..df1b4a31b56dfc9520c57706587f0159bc0b72d1 100644 (file)
--- a/cache.c
+++ b/cache.c
@@ -24,7 +24,7 @@
 
 struct cache_slot {
        const char *key;
-       int keylen;
+       size_t keylen;
        int ttl;
        cache_fill_fn fn;
        int cache_fd;
@@ -44,7 +44,7 @@ struct cache_slot {
 static int open_slot(struct cache_slot *slot)
 {
        char *bufz;
-       int bufkeylen = -1;
+       ssize_t bufkeylen = -1;
 
        slot->cache_fd = open(slot->cache_name, O_RDONLY);
        if (slot->cache_fd == -1)