summaryrefslogtreecommitdiff
path: root/input.c
diff options
context:
space:
mode:
Diffstat (limited to 'input.c')
-rw-r--r--input.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/input.c b/input.c
index e47f363..5a279cc 100644
--- a/input.c
+++ b/input.c
@@ -100,12 +100,11 @@ bool InputHandlerHandle(struct InputHandler* input_handler, int fd) {
// mburakov: Payload of ping message is not yet available.
return true;
}
- char buffer[sizeof(struct Proto) + sizeof(uint64_t)];
- struct Proto* proto = (void*)buffer;
- proto->size = sizeof(uint64_t);
- proto->type = PROTO_TYPE_MISC;
- memcpy(proto->data, &event->u, sizeof(uint64_t));
- if (write(fd, buffer, sizeof(buffer)) != sizeof(buffer)) {
+ struct Proto proto = {
+ .size = sizeof(uint64_t),
+ .type = PROTO_TYPE_MISC,
+ };
+ if (!WriteProto(fd, &proto, &event->u)) {
LOG("Failed to write pong message (%s)", strerror(errno));
return false;
}