Fix off-by-one error
This commit is contained in:
parent
d4e6668865
commit
601fb8cb34
@ -269,12 +269,13 @@ static bool send_json_msg(connsock_t *cs, json_t *json_msg)
|
||||
|
||||
s = json_dumps(json_msg, JSON_ESCAPE_SLASH);
|
||||
LOGDEBUG("Sending json msg: %s", s);
|
||||
len = strlen(s) + 1;
|
||||
len = strlen(s);
|
||||
sent = write_socket(cs->fd, s, len);
|
||||
len += 1;
|
||||
dealloc(s);
|
||||
sent += write_socket(cs->fd, "\n", 1);
|
||||
if (sent != len) {
|
||||
LOGWARNING("Failed to send %d bytes in send_json_msg", len);
|
||||
LOGWARNING("Failed to send %d bytes sent %d in send_json_msg", len, sent);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user