read_gitfile_gently: use ssize_t to hold read result
Otherwise, a negative error return becomes a very large read value. We catch this in practice because we compare the expected and actual numbers of bytes (and you are not likely to be reading (size_t)-1 bytes), but this makes the correctness a little more obvious. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
May 26, 2011 at 12:28 UTC
b1905aeac5aded421cd90f8d264e27bb39672b36
1 file changed
+1
-1
setup.c
+1
-1
@@ -272,7 +272,7 @@ const char *read_gitfile_gently(const char *path)
272
const char *slash;
273
struct stat st;
274
int fd;
275
- size_t len;
275
+ ssize_t len;
276
277
if (stat(path, &st))
278
return NULL;