From e866d68f10f15c325bfe636d23980a14b4361031 Mon Sep 17 00:00:00 2001 From: shadow1ng Date: Thu, 18 Mar 2021 16:25:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9redis=20recover=E6=A8=A1?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Plugins/redis.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Plugins/redis.go b/Plugins/redis.go index 2f48fb6..cf96596 100644 --- a/Plugins/redis.go +++ b/Plugins/redis.go @@ -298,18 +298,30 @@ func getconfig(conn net.Conn) (dbfilename string, dir string, err error) { if err != nil { return } - dbfilename, err = readreply(conn) + text, err := readreply(conn) if err != nil { return } + text1 := strings.Split(text, "\n") + if len(text1) > 2 { + dbfilename = text1[len(text1)-2] + } else { + dbfilename = text1[0] + } _, err = conn.Write([]byte(fmt.Sprintf("CONFIG GET dir\r\n"))) if err != nil { return } - dir, err = readreply(conn) + text, err = readreply(conn) if err != nil { return } + text1 = strings.Split(text, "\n") + if len(text1) > 2 { + dir = text1[len(text1)-2] + } else { + dir = text1[0] + } return }