Skip to content

Commit b1905ae

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5dd5648 commit b1905ae

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

setup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ const char *read_gitfile_gently(const char *path)
272272
const char *slash;
273273
struct stat st;
274274
int fd;
275-
size_t len;
275+
ssize_t len;
276276

277277
if (stat(path, &st))
278278
return NULL;

0 commit comments

Comments
 (0)