From 69f50b948eab5840ca2e66fe311608725657651e Mon Sep 17 00:00:00 2001 From: Bartel Sielski Date: Tue, 17 Mar 2026 13:23:09 +0100 Subject: [PATCH] liblldpctl: Fix const correctness of the receive callback --- src/lib/connection.c | 5 ++--- src/lib/lldpctl.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/lib/connection.c b/src/lib/connection.c index 3ce7dc15..ad2ae6d2 100644 --- a/src/lib/connection.c +++ b/src/lib/connection.c @@ -61,7 +61,7 @@ sync_send(lldpctl_conn_t *lldpctl, const uint8_t *data, size_t length, void *use /* Statically receive data from remote end. */ static ssize_t -sync_recv(lldpctl_conn_t *lldpctl, const uint8_t *data, size_t length, void *user_data) +sync_recv(lldpctl_conn_t *lldpctl, uint8_t *data, size_t length, void *user_data) { struct lldpctl_conn_sync_t *conn = user_data; ssize_t nb = 0; @@ -92,8 +92,7 @@ sync_recv(lldpctl_conn_t *lldpctl, const uint8_t *data, size_t length, void *use if (fds[1].revents & POLLIN) { /* Message from daemon. */ - if ((nb = read(conn->fd, (unsigned char *)data + offset, - remain)) == -1) { + if ((nb = read(conn->fd, data + offset, remain)) == -1) { if (errno == EAGAIN || errno == EINTR) continue; return LLDPCTL_ERR_CALLBACK_FAILURE; } diff --git a/src/lib/lldpctl.h b/src/lib/lldpctl.h index d77fc481..cc5870b8 100644 --- a/src/lib/lldpctl.h +++ b/src/lib/lldpctl.h @@ -129,7 +129,7 @@ typedef ssize_t (*lldpctl_send_callback)(lldpctl_conn_t *conn, const uint8_t *da * @c LLDPCTL_ERR_CALLBACK_FAILURE for other errors or @c * LLDPCTL_ERR_EOF if end of file was reached. */ -typedef ssize_t (*lldpctl_recv_callback)(lldpctl_conn_t *conn, const uint8_t *data, +typedef ssize_t (*lldpctl_recv_callback)(lldpctl_conn_t *conn, uint8_t *data, size_t length, void *user_data); /** -- 2.47.3