From 49d639ecabe32e02e4fc41e27bb61005fd25931d Mon Sep 17 00:00:00 2001 From: chrislusf Date: Tue, 14 Apr 2015 23:05:33 -0700 Subject: [PATCH] Add error checking for file reads. --- go/storage/volume.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/go/storage/volume.go b/go/storage/volume.go index e35eeee49..217a82373 100644 --- a/go/storage/volume.go +++ b/go/storage/volume.go @@ -152,7 +152,11 @@ func (v *Volume) isFileUnchanged(n *Needle) bool { nv, ok := v.nm.Get(n.Id) if ok && nv.Offset > 0 { oldNeedle := new(Needle) - oldNeedle.Read(v.dataFile, int64(nv.Offset)*NeedlePaddingSize, nv.Size, v.Version()) + _, err := oldNeedle.Read(v.dataFile, int64(nv.Offset)*NeedlePaddingSize, nv.Size, v.Version()) + if err != nil { + glog.V(0).Infof("Failed to check updated file %v", err) + return false + } if oldNeedle.Checksum == n.Checksum && bytes.Equal(oldNeedle.Data, n.Data) { n.DataSize = oldNeedle.DataSize return true