]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
lib: fix formatting
authorVincent Bernat <vincent@bernat.ch>
Sat, 7 Dec 2024 10:48:12 +0000 (11:48 +0100)
committerVincent Bernat <vincent@bernat.ch>
Sat, 7 Dec 2024 10:48:12 +0000 (11:48 +0100)
src/client/show.c
src/lib/atom.c
src/lib/atom.h
src/lib/connection.c

index fff6fc89c05c94a3180d473e2cd292b84fd0f809..426a9dacd64912ae36cf2ed89cbacfaaa72e3006 100644 (file)
@@ -239,8 +239,9 @@ cmd_watch_neighbors(struct lldpctl_conn_t *conn, struct writer *w, struct cmd_en
        while (1) {
                if (lldpctl_watch(conn) < 0) {
                        if (lldpctl_last_error(conn) != LLDPCTL_ERR_CALLBACK_UNBLOCK) {
-                               log_warnx("lldpctl", "unable to watch for neighbors. %s",
-                                       lldpctl_last_strerror(conn));
+                               log_warnx("lldpctl",
+                                   "unable to watch for neighbors. %s",
+                                   lldpctl_last_strerror(conn));
                        }
                        return 0;
                }
index f5a851c7407d1b7c7bd0835d2ff13b318f26ad46..a3a60c46cc3c5950251e8fcac2e639265546c22e 100644 (file)
@@ -404,17 +404,16 @@ lldpctl_watch(lldpctl_conn_t *conn)
 void
 lldpctl_watch_sync_unblock(lldpctl_conn_t *conn)
 {
-       if (conn->state != CONN_STATE_WATCHING)
-               return;
+       if (conn->state != CONN_STATE_WATCHING) return;
 
-       if (!conn->sync_clb)
-               return;
+       if (!conn->sync_clb) return;
 
        struct lldpctl_conn_sync_t *data = conn->user_data;
 
        if (data->pipe_fd[1] != -1) {
                /* Write to the pipe to unblock the read */
-               write(data->pipe_fd[1], "x", 1);
+               ssize_t rc = write(data->pipe_fd[1], "x", 1);
+               (void)rc;
        }
 }
 
index c75615c6ff7868f4dafc8e3fb6ef07604af58dd9..387bd533c21ea33231a9d757c595e9be8d6a1408 100644 (file)
@@ -30,7 +30,7 @@ struct lldpctl_conn_t {
        lldpctl_recv_callback recv; /* Receive callback */
        lldpctl_send_callback send; /* Send callback */
        void *user_data;            /* Callback user data */
-       uint8_t sync_clb;       /* If set synchronous callbacks are used */
+       uint8_t sync_clb;           /* If set synchronous callbacks are used */
 
        /* IO state handling. */
        uint8_t *input_buffer;  /* Current input/output buffer */
@@ -76,8 +76,9 @@ struct lldpctl_conn_t {
 
 /* User data for synchronous callbacks. */
 struct lldpctl_conn_sync_t {
-       int fd; /* File descriptor to the socket. */
-       int pipe_fd[2]; /* Pipe file descriptors required for unblocking a read-blocked watcher. */
+       int fd;         /* File descriptor to the socket. */
+       int pipe_fd[2]; /* Pipe file descriptors required for unblocking a read-blocked
+                          watcher. */
 };
 
 ssize_t _lldpctl_needs(lldpctl_conn_t *lldpctl, size_t length);
index 2c0c0cd918b6f73585743c9cccce8fdde52e3c42..ce3bc9123e1c54dcf406222f13f5e8a98ee409c5 100644 (file)
@@ -76,11 +76,11 @@ sync_recv(lldpctl_conn_t *lldpctl, const uint8_t *data, size_t length, void *use
        fds[0].fd = conn->pipe_fd[0];
        fds[0].events = POLLIN;
        fds[1].fd = conn->fd;
-       fds[1].events = POLLIN; 
+       fds[1].events = POLLIN;
 
        remain = length;
        do {
-               if (poll(fds, sizeof(fds)/sizeof(fds[0]), -1) == -1) {
+               if (poll(fds, sizeof(fds) / sizeof(fds[0]), -1) == -1) {
                        if (errno == EINTR) continue;
                        return LLDPCTL_ERR_CALLBACK_FAILURE;
                }
@@ -89,10 +89,11 @@ sync_recv(lldpctl_conn_t *lldpctl, const uint8_t *data, size_t length, void *use
                        /* Unblock request received. */
                        return LLDPCTL_ERR_CALLBACK_UNBLOCK;
                }
-               
+
                if (fds[1].revents & POLLIN) {
                        /* Message from daemon. */
-                       if ((nb = read(conn->fd, (unsigned char *)data + offset, remain)) == -1) {
+                       if ((nb = read(conn->fd, (unsigned char *)data + offset,
+                                remain)) == -1) {
                                if (errno == EAGAIN || errno == EINTR) continue;
                                return LLDPCTL_ERR_CALLBACK_FAILURE;
                        }
@@ -128,7 +129,8 @@ lldpctl_new_name(const char *ctlname, lldpctl_send_callback send,
                goto end;
        }
        if (!send && !recv) {
-               if ((data = malloc(sizeof(struct lldpctl_conn_sync_t))) == NULL) goto end;
+               if ((data = malloc(sizeof(struct lldpctl_conn_sync_t))) == NULL)
+                       goto end;
                if (pipe(data->pipe_fd) == -1) goto end;
                data->fd = -1;
                conn->send = sync_send;