mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #16201 from Tachone/release-3.5
[Backport 3.5] etcdutl: fix db double closed
This commit is contained in:
commit
d4f779a643
@ -415,13 +415,8 @@ func (s *v3Manager) copyAndVerifyDB() error {
|
|||||||
if dberr != nil {
|
if dberr != nil {
|
||||||
return dberr
|
return dberr
|
||||||
}
|
}
|
||||||
dbClosed := false
|
defer db.Close()
|
||||||
defer func() {
|
|
||||||
if !dbClosed {
|
|
||||||
db.Close()
|
|
||||||
dbClosed = true
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
if _, err := io.Copy(db, srcf); err != nil {
|
if _, err := io.Copy(db, srcf); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -458,7 +453,7 @@ func (s *v3Manager) copyAndVerifyDB() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// db hash is OK, can now modify DB so it can be part of a new cluster
|
// db hash is OK, can now modify DB so it can be part of a new cluster
|
||||||
db.Close()
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user