aboutgitcodebugslistschat
path: root/udp.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-10-19 17:28:18 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-10-20 08:29:30 +0200
commit1a563a0cbd4926d0dfe9065a4fcd8771c5b292cc (patch)
tree13ee3b6da82e5eb53a89bb881ccf3a7092dab9fe /udp.c
parent087b5f4dbb9e3f767a8afbb6c1001c509965940b (diff)
downloadpasst-1a563a0cbd4926d0dfe9065a4fcd8771c5b292cc.tar
passt-1a563a0cbd4926d0dfe9065a4fcd8771c5b292cc.tar.gz
passt-1a563a0cbd4926d0dfe9065a4fcd8771c5b292cc.tar.bz2
passt-1a563a0cbd4926d0dfe9065a4fcd8771c5b292cc.tar.lz
passt-1a563a0cbd4926d0dfe9065a4fcd8771c5b292cc.tar.xz
passt-1a563a0cbd4926d0dfe9065a4fcd8771c5b292cc.tar.zst
passt-1a563a0cbd4926d0dfe9065a4fcd8771c5b292cc.zip
passt: Address gcc 11 warnings
A mix of unchecked return values, a missing permission mask for open(2) with O_CREAT, and some false positives from -Wstringop-overflow and -Wmaybe-uninitialized. Reported-by: Martin Hauke <mardnh@gmx.de> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'udp.c')
-rw-r--r--udp.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/udp.c b/udp.c
index ceb10a6..5c0e955 100644
--- a/udp.c
+++ b/udp.c
@@ -536,8 +536,8 @@ static void udp_sock_handler_splice(struct ctx *c, union epoll_ref ref,
uint32_t events, struct timespec *now)
{
struct msghdr *mh = &udp_splice_mmh_recv[0].msg_hdr;
+ in_port_t src, dst = ref.udp.port, send_dst = 0;
struct sockaddr_storage *sa_s = mh->msg_name;
- in_port_t src, dst = ref.udp.port, send_dst;
int s, v6 = ref.udp.v6, n, i;
if (!(events & EPOLLIN))
@@ -721,7 +721,8 @@ void udp_sock_handler(struct ctx *c, union epoll_ref ref, uint32_t events,
if (c->mode == MODE_PASTA) {
ip_len += sizeof(struct ethhdr);
- write(c->fd_tap, &b->eh, ip_len);
+ if (write(c->fd_tap, &b->eh, ip_len) < 0)
+ debug("tap write: %s", strerror(errno));
pcap((char *)&b->eh, ip_len);
continue;
}
@@ -791,7 +792,8 @@ void udp_sock_handler(struct ctx *c, union epoll_ref ref, uint32_t events,
if (c->mode == MODE_PASTA) {
ip_len += sizeof(struct ethhdr);
- write(c->fd_tap, &b->eh, ip_len);
+ if (write(c->fd_tap, &b->eh, ip_len) < 0)
+ debug("tap write: %s", strerror(errno));
pcap((char *)&b->eh, ip_len);
continue;
}