diff options
author | John Keeping | 2016-01-16 11:03:06 +0000 |
---|---|---|
committer | Jason A. Donenfeld | 2016-01-17 17:05:19 +0100 |
commit | 3fbfced7401cfcbb8006a9a6ce4add6b37a41a55 (patch) | |
tree | ba068905ab00c96c3528783649467c4b3b8aad65 | |
parent | ui-log: handle parse_commit() errors (diff) | |
download | cgit-3fbfced7401cfcbb8006a9a6ce4add6b37a41a55.tar.gz cgit-3fbfced7401cfcbb8006a9a6ce4add6b37a41a55.zip |
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>
-rw-r--r-- | cache.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cache.c b/cache.c index b169d20..df1b4a3 100644 --- a/cache.c +++ b/cache.c | |||
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | struct cache_slot { | 25 | struct cache_slot { |
26 | const char *key; | 26 | const char *key; |
27 | int keylen; | 27 | size_t keylen; |
28 | int ttl; | 28 | int ttl; |
29 | cache_fill_fn fn; | 29 | cache_fill_fn fn; |
30 | int cache_fd; | 30 | int cache_fd; |
@@ -44,7 +44,7 @@ struct cache_slot { | |||
44 | static int open_slot(struct cache_slot *slot) | 44 | static int open_slot(struct cache_slot *slot) |
45 | { | 45 | { |
46 | char *bufz; | 46 | char *bufz; |
47 | int bufkeylen = -1; | 47 | ssize_t bufkeylen = -1; |
48 | 48 | ||
49 | slot->cache_fd = open(slot->cache_name, O_RDONLY); | 49 | slot->cache_fd = open(slot->cache_name, O_RDONLY); |
50 | if (slot->cache_fd == -1) | 50 | if (slot->cache_fd == -1) |