unbreak socket comms

This commit is contained in:
Dan Ballard 2014-12-31 07:58:19 -08:00
parent 02bd84893d
commit 13cad25620
2 changed files with 2 additions and 1 deletions

View File

@ -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)
}

View File

@ -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)