summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 93aa7bd)
raw | patch | inline | side by side (parent: 93aa7bd)
author | Jim Meyering <jim@meyering.net> | |
Thu, 26 May 2011 14:34:20 +0000 (16:34 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 26 May 2011 18:25:59 +0000 (11:25 -0700) |
Using an unsigned type, we would fail to detect a read error and then
proceed to try to write (size_t)-1 bytes.
Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
proceed to try to write (size_t)-1 bytes.
Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_file.c | patch | blob | history |
diff --git a/sha1_file.c b/sha1_file.c
index 5fc877fe4c579f97e3f5f6e6cebf5742e8a46a32..8a85217996a80af300f544fa9a3d8d905b50f266 100644 (file)
--- a/sha1_file.c
+++ b/sha1_file.c
while (size) {
char buf[10240];
size_t sz = size < sizeof(buf) ? size : sizeof(buf);
- size_t actual;
+ ssize_t actual;
actual = read_in_full(fd, buf, sz);
if (actual < 0)