Skip to content

Commit

Permalink
read_gitfile_gently: use ssize_t to hold read result
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
peff authored and gitster committed May 26, 2011
1 parent 5dd5648 commit b1905ae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion setup.c
Expand Up @@ -272,7 +272,7 @@ const char *read_gitfile_gently(const char *path)
const char *slash;
struct stat st;
int fd;
size_t len;
ssize_t len;

if (stat(path, &st))
return NULL;
Expand Down

0 comments on commit b1905ae

Please sign in to comment.