summaryrefslogtreecommitdiff
path: root/fast-import.c
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-01-16 05:35:41 (GMT)
committerShawn O. Pearce <spearce@spearce.org>2007-01-16 05:35:41 (GMT)
commit6cf092619376f5bf60987f146d142497ded2f718 (patch)
tree2129ce8388a07fe60f2a9796ecd72cb5829cb727 /fast-import.c
parent0ea9f045f4eaa1d37c6b318d9d6849a4f447b997 (diff)
downloadgit-6cf092619376f5bf60987f146d142497ded2f718.zip
git-6cf092619376f5bf60987f146d142497ded2f718.tar.gz
git-6cf092619376f5bf60987f146d142497ded2f718.tar.bz2
Replace redundant yread() with read_in_full() in fast-import.
Prior to git having read_in_full() fast-import used its own private function yread to perform the header reading task. No sense in keeping that around now that read_in_full is a public, stable function. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'fast-import.c')
-rw-r--r--fast-import.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/fast-import.c b/fast-import.c
index ebffa7c..938707c 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -590,19 +590,6 @@ static void release_tree_entry(struct tree_entry *e)
avail_tree_entry = e;
}
-static void yread(int fd, void *buffer, size_t length)
-{
- ssize_t ret = 0;
- while (ret < length) {
- ssize_t size = xread(fd, (char *) buffer + ret, length - ret);
- if (!size)
- die("Read from descriptor %i: end of stream", fd);
- if (size < 0)
- die("Read from descriptor %i: %s", fd, strerror(errno));
- ret += size;
- }
-}
-
static void start_packfile()
{
struct packed_git *p;
@@ -642,7 +629,8 @@ static void fixup_header_footer()
die("Failed seeking to start: %s", strerror(errno));
SHA1_Init(&c);
- yread(pack_fd, hdr, 8);
+ if (read_in_full(pack_fd, hdr, 8) != 8)
+ die("Unable to reread header of %s", pack_data->pack_name);
SHA1_Update(&c, hdr, 8);
cnt = htonl(object_count);