diff --git a/cmd/warren/cmd_run.go b/cmd/warren/cmd_run.go index fb8a91a..e14423e 100644 --- a/cmd/warren/cmd_run.go +++ b/cmd/warren/cmd_run.go @@ -30,6 +30,7 @@ func runRun(cmd *Command, args ...string) { } s, err := net.Dial(warren.CmdSockType(), warren.CmdSockAddr()) + defer s.Close() if err != nil { log.Fatal("Error connecting to warrend:", err) } diff --git a/lib/warren/warren.go b/lib/warren/warren.go index ad8cff8..ea12468 100644 --- a/lib/warren/warren.go +++ b/lib/warren/warren.go @@ -47,7 +47,7 @@ func ReadStringz(c net.Conn) (string, error) { data := "" buf := make([]byte, 1024) // Max size of buff based on? - for len(data) > 0 && data[len(data)-1] == 0 { + for len(data) == 0 || byte(data[len(data)-1]) != 0 { nr, err := c.Read(buf) if err != nil { fmt.Println("readStringz read error:", err)