Przeglądaj źródła

etcdctl/ctlv3: close bolt.DB in snapshot status

Gyu-Ho Lee 9 lat temu
rodzic
commit
53abaf86c6
1 zmienionych plików z 2 dodań i 1 usunięć
  1. 2 1
      etcdctl/ctlv3/command/snapshot_command.go

+ 2 - 1
etcdctl/ctlv3/command/snapshot_command.go

@@ -305,10 +305,11 @@ func dbStatus(p string) dbstatus {
 
 
 	ds := dbstatus{}
 	ds := dbstatus{}
 
 
-	db, err := bolt.Open(p, 0600, nil)
+	db, err := bolt.Open(p, 0400, nil)
 	if err != nil {
 	if err != nil {
 		ExitWithError(ExitError, err)
 		ExitWithError(ExitError, err)
 	}
 	}
+	defer db.Close()
 
 
 	h := crc32.New(crc32.MakeTable(crc32.Castagnoli))
 	h := crc32.New(crc32.MakeTable(crc32.Castagnoli))