mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdutl: fix db double closed
Signed-off-by: shitao.lst <acm_tach@163.com>
This commit is contained in:
@@ -340,13 +340,8 @@ func (s *v3Manager) copyAndVerifyDB() error {
|
||||
if dberr != nil {
|
||||
return dberr
|
||||
}
|
||||
dbClosed := false
|
||||
defer func() {
|
||||
if !dbClosed {
|
||||
db.Close()
|
||||
dbClosed = true
|
||||
}
|
||||
}()
|
||||
defer db.Close()
|
||||
|
||||
if _, err := io.Copy(db, srcf); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -383,7 +378,7 @@ func (s *v3Manager) copyAndVerifyDB() error {
|
||||
}
|
||||
|
||||
// db hash is OK, can now modify DB so it can be part of a new cluster
|
||||
db.Close()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user