summaryrefslogtreecommitdiff
path: root/vcs-svn/fast_export.c
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2011-03-22 23:11:59 (GMT)
committerJonathan Nieder <jrnieder@gmail.com>2011-03-22 23:11:59 (GMT)
commit5c674860eb8bfa1a8c0038fc2d32c4fc205e9d62 (patch)
tree500514c85fa75199f38f87bc2f548aa1137f2b76 /vcs-svn/fast_export.c
parentdd3f42ad793b5334d506a451addcefd0054c27bb (diff)
parent90c0a3cfe390208c86144bf97ec8fa5610febe0f (diff)
downloadgit-5c674860eb8bfa1a8c0038fc2d32c4fc205e9d62.zip
git-5c674860eb8bfa1a8c0038fc2d32c4fc205e9d62.tar.gz
git-5c674860eb8bfa1a8c0038fc2d32c4fc205e9d62.tar.bz2
Merge branch 'db/length-as-hash' (early part) into db/svn-fe-code-purge
* 'db/length-as-hash' (early part): vcs-svn: implement perfect hash for top-level keys vcs-svn: implement perfect hash for node-prop keys vcs-svn: improve reporting of input errors vcs-svn: make buffer_copy_bytes return length read vcs-svn: make buffer_skip_bytes return length read vcs-svn: improve support for reading large files Conflicts: vcs-svn/fast_export.c vcs-svn/svndump.c
Diffstat (limited to 'vcs-svn/fast_export.c')
-rw-r--r--vcs-svn/fast_export.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/vcs-svn/fast_export.c b/vcs-svn/fast_export.c
index f19db9a..32f0c8c 100644
--- a/vcs-svn/fast_export.c
+++ b/vcs-svn/fast_export.c
@@ -121,15 +121,24 @@ static const char *get_response_line(void)
die("unexpected end of fast-import feedback");
}
+static void die_short_read(struct line_buffer *input)
+{
+ if (buffer_ferror(input))
+ die_errno("error reading dump file");
+ die("invalid dump: unexpected end of file");
+}
+
void fast_export_data(uint32_t mode, uint32_t len, struct line_buffer *input)
{
if (mode == REPO_MODE_LNK) {
/* svn symlink blobs start with "link " */
- buffer_skip_bytes(input, 5);
len -= 5;
+ if (buffer_skip_bytes(input, 5) != 5)
+ die_short_read(input);
}
printf("data %"PRIu32"\n", len);
- buffer_copy_bytes(input, len);
+ if (buffer_copy_bytes(input, len) != len)
+ die_short_read(input);
fputc('\n', stdout);
}