Date: Wed, 16 Oct 2024 16:25:59 GMT From: Igor Ostapenko <igoro@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: b3e7d4b67ce6 - main - tests: Fix style of netpfil/common/divapp.c Message-ID: <202410161625.49GGPx6u076807@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by igoro: URL: https://cgit.FreeBSD.org/src/commit/?id=b3e7d4b67ce653bcdd9ec671cfdcdfed58a0ea50 commit b3e7d4b67ce653bcdd9ec671cfdcdfed58a0ea50 Author: Igor Ostapenko <igoro@FreeBSD.org> AuthorDate: 2024-10-16 16:24:54 +0000 Commit: Igor Ostapenko <igoro@FreeBSD.org> CommitDate: 2024-10-16 16:24:54 +0000 tests: Fix style of netpfil/common/divapp.c No functional change intended. Reviewed by: markj Approved by: markj (mentor) Differential Revision: https://reviews.freebsd.org/D47132 --- tests/sys/netpfil/common/divapp.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/tests/sys/netpfil/common/divapp.c b/tests/sys/netpfil/common/divapp.c index f3e41f010fef..d0f4b345b14c 100644 --- a/tests/sys/netpfil/common/divapp.c +++ b/tests/sys/netpfil/common/divapp.c @@ -83,8 +83,8 @@ recv_pkt(struct context *c) s = select(c->fd + 1, &readfds, 0, 0, &timeout); if (s == -1) errx(EX_IOERR, "recv_pkt: select() errors."); - if (s != 1) // timeout - return -1; + if (s != 1) /* timeout */ + return (-1); c->pkt_n = recvfrom(c->fd, c->pkt, sizeof(c->pkt), 0, (struct sockaddr *) &c->sin, &c->sin_len); @@ -98,14 +98,11 @@ static void send_pkt(struct context *c) { ssize_t n; - char errstr[32]; n = sendto(c->fd, c->pkt, c->pkt_n, 0, (struct sockaddr *) &c->sin, c->sin_len); - if (n == -1) { - strerror_r(errno, errstr, sizeof(errstr)); - errx(EX_IOERR, "send_pkt: sendto() errors: %d %s.", errno, errstr); - } + if (n == -1) + err(EX_IOERR, "send_pkt: sendto() errors"); if (n != c->pkt_n) errx(EX_IOERR, "send_pkt: sendto() sent %zd of %zd bytes.", n, c->pkt_n); @@ -145,5 +142,5 @@ main(int argc, char *argv[]) if (npkt != 1) errx(EXIT_FAILURE, "%d: npkt=%d.", c.divert_port, npkt); - return EXIT_SUCCESS; + return (EXIT_SUCCESS); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202410161625.49GGPx6u076807>