1
0
mirror of https://github.com/gluster/glusterd2.git synced 2026-02-05 12:45:38 +01:00

Valiate Last Error Response in failure function of GlusterCli

If last Error Response is nil, then calling failure function will cause
segmentation fault error
Fixes #1115

Signed-off-by: Oshank Kumar <okumar@redhat.com>
This commit is contained in:
Oshank Kumar
2018-08-02 17:03:37 +05:30
committed by Prashanth Pai
parent e09c9a994d
commit 85692c7411

View File

@@ -56,9 +56,14 @@ func failure(msg string, err error, errcode int) {
w.WriteString(msg + "\n")
if err != nil {
resp := client.LastErrorResponse()
resp := client.LastErrorResponse()
if resp == nil && err != nil {
fmt.Fprintln(w, err)
os.Exit(errcode)
}
if err != nil {
w.WriteString("\nResponse headers:\n")
for k, v := range resp.Header {
if strings.HasSuffix(k, "-Id") {