summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8b7d510)
raw | patch | inline | side by side (parent: 8b7d510)
author | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Sun, 29 May 2005 19:06:32 +0000 (12:06 -0700) | ||
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Sun, 29 May 2005 19:06:32 +0000 (12:06 -0700) |
Instead of always assuming it can be read with a single
read() system call, loop around properly.
Pointed out by Pasky, but I ended up implementing it differently
from his suggested patch.
read() system call, loop around properly.
Pointed out by Pasky, but I ended up implementing it differently
from his suggested patch.
mktag.c | patch | blob | history |
index aa4a6d863bfb9e091b900470de2d03fa431bbfe2..8cbbef67e624d1d15bc4f2d7e2f9509be937c36d 100644 (file)
--- a/mktag.c
+++ b/mktag.c
usage("cat <signaturefile> | git-mktag");
// Read the signature
- size = read(0, buffer, MAXSIZE);
+ size = 0;
+ for (;;) {
+ int ret = read(0, buffer + size, MAXSIZE - size);
+ if (!ret)
+ break;
+ if (ret < 0) {
+ if (errno == EAGAIN)
+ continue;
+ break;
+ }
+ size += ret;
+ }
// Verify it for some basic sanity: it needs to start with "object <sha1>\ntype "
if (verify_tag(buffer, size) < 0)