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
3bf3ad9f
Commit
3bf3ad9f
authored
Jun 21, 2011
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #269 from schu/infinite-append
gitfo_read: fix read-loop
parents
b3f2d4cb
28f7869d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
4 deletions
+20
-4
src/fileops.c
+2
-4
tests/t00-core.c
+18
-0
No files found.
src/fileops.c
View file @
3bf3ad9f
...
...
@@ -90,10 +90,8 @@ int gitfo_read(git_file fd, void *buf, size_t cnt)
continue
;
return
git__throw
(
GIT_EOSERR
,
"Failed to read from file"
);
}
if
(
!
r
)
{
errno
=
EPIPE
;
return
git__throw
(
GIT_EOSERR
,
"Failed to read from file"
);
}
if
(
!
r
)
break
;
cnt
-=
r
;
b
+=
r
;
}
...
...
tests/t00-core.c
View file @
3bf3ad9f
...
...
@@ -675,6 +675,23 @@ BEGIN_TEST(filebuf0, "make sure git_filebuf_open doesn't delete an existing lock
must_pass
(
gitfo_unlink
(
testlock
));
END_TEST
BEGIN_TEST
(
filebuf1
,
"make sure GIT_FILEBUF_APPEND works as expected"
)
git_filebuf
file
;
int
fd
;
char
test
[]
=
"test"
;
fd
=
gitfo_creat
(
test
,
0644
);
must_pass
(
fd
);
must_pass
(
gitfo_write
(
fd
,
"libgit2 rocks
\n
"
,
14
));
must_pass
(
gitfo_close
(
fd
));
must_pass
(
git_filebuf_open
(
&
file
,
test
,
GIT_FILEBUF_APPEND
));
must_pass
(
git_filebuf_printf
(
&
file
,
"%s
\n
"
,
"libgit2 rocks"
));
must_pass
(
git_filebuf_commit
(
&
file
));
must_pass
(
gitfo_unlink
(
test
));
END_TEST
BEGIN_SUITE
(
core
)
ADD_TEST
(
string0
);
ADD_TEST
(
string1
);
...
...
@@ -698,4 +715,5 @@ BEGIN_SUITE(core)
ADD_TEST
(
dirent4
);
ADD_TEST
(
filebuf0
);
ADD_TEST
(
filebuf1
);
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