mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 20:05:06 -05:00
client: don't try sending request with invalid socket
This commit is contained in:
9
client.c
9
client.c
@@ -1317,14 +1317,19 @@ submit_request(CMD_Request *request, CMD_Reply *reply)
|
|||||||
/* Zero the padding to avoid sending uninitialized data */
|
/* Zero the padding to avoid sending uninitialized data */
|
||||||
memset(((char *)request) + command_length - padding_length, 0, padding_length);
|
memset(((char *)request) + command_length - padding_length, 0, padding_length);
|
||||||
|
|
||||||
|
if (sock_fd < 0) {
|
||||||
|
DEBUG_LOG(LOGF_Client, "No socket to send request");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (send(sock_fd, (void *)request, command_length, 0) < 0) {
|
if (send(sock_fd, (void *)request, command_length, 0) < 0) {
|
||||||
DEBUG_LOG(LOGF_Client, "Could not send %d bytes : %s",
|
DEBUG_LOG(LOGF_Client, "Could not send %d bytes : %s",
|
||||||
command_length, strerror(errno));
|
command_length, strerror(errno));
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
|
||||||
DEBUG_LOG(LOGF_Client, "Sent %d bytes", command_length);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEBUG_LOG(LOGF_Client, "Sent %d bytes", command_length);
|
||||||
|
|
||||||
/* Increment this for next time */
|
/* Increment this for next time */
|
||||||
++ request->attempt;
|
++ request->attempt;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user