aboutsummaryrefslogtreecommitdiff
path: root/internal/ctlsock/ctlsock_serve.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2017-01-29 18:24:47 +0100
committerJakob Unterwurzacher2017-01-29 18:25:46 +0100
commit53fe6f569042200b9a390bccb589829ce1ec0dce (patch)
tree94b50c33f0753ef44e76881673587039d7b69ff4 /internal/ctlsock/ctlsock_serve.go
parent532ef15417072cf6c6bd6576d78588f96800fa43 (diff)
ctlsock: abort message processing on JSON error
The code was missing a "continue" in that branch. Also improve the error messages a bit.
Diffstat (limited to 'internal/ctlsock/ctlsock_serve.go')
-rw-r--r--internal/ctlsock/ctlsock_serve.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/internal/ctlsock/ctlsock_serve.go b/internal/ctlsock/ctlsock_serve.go
index 7e60301..51f1de4 100644
--- a/internal/ctlsock/ctlsock_serve.go
+++ b/internal/ctlsock/ctlsock_serve.go
@@ -98,12 +98,13 @@ func (ch *ctlSockHandler) handleConnection(conn *net.UnixConn) {
var in RequestStruct
err = json.Unmarshal(buf, &in)
if err != nil {
- tlog.Warn.Printf("ctlsock: Unmarshal error: %#v", err)
+ tlog.Warn.Printf("ctlsock: JSON Unmarshal error: %#v", err)
errorMsg := ResponseStruct{
ErrNo: int32(syscall.EINVAL),
- ErrText: err.Error(),
+ ErrText: "JSON Unmarshal error: " + err.Error(),
}
sendResponse(&errorMsg, conn)
+ continue
}
ch.handleRequest(&in, conn)
// Restore original size.
@@ -139,7 +140,7 @@ func (ch *ctlSockHandler) handleRequest(in *RequestStruct, conn *net.UnixConn) {
}
}
if inPath != clean {
- out.WarnText = fmt.Sprintf("Non-canonical input path %q has been interpreted as %q", inPath, clean)
+ out.WarnText = fmt.Sprintf("Non-canonical input path '%s' has been interpreted as '%s'.", inPath, clean)
}
sendResponse(&out, conn)
}