aboutsummaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-06-19 18:28:07 +0200
committerGitHub <noreply@github.com>2017-06-19 18:28:07 +0200
commit65bf694a758c768488685fff6b2c275f4bfe6b87 (patch)
tree3a7563a92d404862c5975ab696d514340ca48581 /storage
parentdfd68a1f987fc529a7626cc6ea1141f371115777 (diff)
parent76281a5d1d715cd25f439da87bea1419648d78e9 (diff)
downloadgo-git-65bf694a758c768488685fff6b2c275f4bfe6b87.tar.gz
Merge pull request #442 from ajnavarro/fix/stackoverflow
internal/dotgit: rewrite code to avoid stackoverflow errors
Diffstat (limited to 'storage')
-rw-r--r--storage/filesystem/internal/dotgit/writers.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/storage/filesystem/internal/dotgit/writers.go b/storage/filesystem/internal/dotgit/writers.go
index 2407c58..e0a41a8 100644
--- a/storage/filesystem/internal/dotgit/writers.go
+++ b/storage/filesystem/internal/dotgit/writers.go
@@ -190,14 +190,14 @@ func (s *syncedReader) Write(p []byte) (n int, err error) {
func (s *syncedReader) Read(p []byte) (n int, err error) {
defer func() { atomic.AddUint64(&s.read, uint64(n)) }()
- s.sleep()
- n, err = s.r.Read(p)
- if err == io.EOF && !s.isDone() {
- if n == 0 {
- return s.Read(p)
+ for {
+ s.sleep()
+ n, err = s.r.Read(p)
+ if err == io.EOF && !s.isDone() && n == 0 {
+ continue
}
- return n, nil
+ break
}
return