浏览代码

etcdctl: snapshot status error for non-existent file

Gyu-Ho Lee 9 年之前
父节点
当前提交
a78ece4ac2
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      etcdctl/ctlv3/command/snapshot_command.go

+ 4 - 0
etcdctl/ctlv3/command/snapshot_command.go

@@ -297,6 +297,10 @@ type dbstatus struct {
 }
 
 func dbStatus(p string) dbstatus {
+	if _, err := os.Stat(p); err != nil {
+		ExitWithError(ExitError, err)
+	}
+
 	ds := dbstatus{}
 
 	db, err := bolt.Open(p, 0600, nil)