Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
1f61e301
Commit
1f61e301
authored
Jun 30, 2011
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #287 from kiryl/development
filebuf: fix endless loop on writing buf > WRITE_BUFFER_SIZE
parents
02bc2d2f
fe5babac
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
+15
-0
src/filebuf.c
+1
-0
tests/t00-core.c
+14
-0
No files found.
src/filebuf.c
View file @
1f61e301
...
...
@@ -331,6 +331,7 @@ int git_filebuf_write(git_filebuf *file, const void *buff, size_t len)
error
=
file
->
write
(
file
,
buf
,
len
);
if
(
error
<
GIT_SUCCESS
)
return
git__rethrow
(
error
,
"Failed to write to buffer"
);
return
GIT_SUCCESS
;
}
}
}
...
...
tests/t00-core.c
View file @
1f61e301
...
...
@@ -692,6 +692,19 @@ BEGIN_TEST(filebuf1, "make sure GIT_FILEBUF_APPEND works as expected")
must_pass
(
gitfo_unlink
(
test
));
END_TEST
BEGIN_TEST
(
filebuf2
,
"make sure git_filebuf_write writes large buffer correctly"
)
git_filebuf
file
;
char
test
[]
=
"test"
;
unsigned
char
buf
[
4096
*
4
];
/* 2 * WRITE_BUFFER_SIZE */
memset
(
buf
,
0xfe
,
sizeof
(
buf
));
must_pass
(
git_filebuf_open
(
&
file
,
test
,
0
));
must_pass
(
git_filebuf_write
(
&
file
,
buf
,
sizeof
(
buf
)));
must_pass
(
git_filebuf_commit
(
&
file
));
must_pass
(
gitfo_unlink
(
test
));
END_TEST
BEGIN_SUITE
(
core
)
ADD_TEST
(
string0
);
ADD_TEST
(
string1
);
...
...
@@ -716,4 +729,5 @@ BEGIN_SUITE(core)
ADD_TEST
(
filebuf0
);
ADD_TEST
(
filebuf1
);
ADD_TEST
(
filebuf2
);
END_SUITE
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment