Check file has been opened before closing it
Signed-off-by: Sylvain Baubeau <sbaubeau@redhat.com>
This commit is contained in:
parent
1a80ec340b
commit
d0dd36125c
1 changed files with 3 additions and 3 deletions
|
@ -312,12 +312,12 @@ func (d *driver) WriteStream(ctx context.Context, path string, offset int64, rea
|
||||||
// Offset is inside the current segment : we need to read the
|
// Offset is inside the current segment : we need to read the
|
||||||
// data from the beginning of the segment to offset
|
// data from the beginning of the segment to offset
|
||||||
file, _, err := d.Conn.ObjectOpen(d.Container, getSegment(), false, nil)
|
file, _, err := d.Conn.ObjectOpen(d.Container, getSegment(), false, nil)
|
||||||
defer file.Close()
|
|
||||||
paddingReader = file
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, parseError(getSegment(), err)
|
return 0, parseError(getSegment(), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defer file.Close()
|
||||||
|
paddingReader = file
|
||||||
}
|
}
|
||||||
|
|
||||||
readers := []io.Reader{}
|
readers := []io.Reader{}
|
||||||
|
|
Loading…
Reference in a new issue