1. Stefan Saasen
  2. git


Jeff King  committed b1905ae

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>

  • Participants
  • Parent commits 5dd5648
  • Branches master

Comments (0)

Files changed (1)

File setup.c

View file
 	const char *slash;
 	struct stat st;
 	int fd;
-	size_t len;
+	ssize_t len;
 	if (stat(path, &st))
 		return NULL;