5463623d28
- Add error checking in hackbench to connect and getsockname - Fix compile warnings in hackbench because of comparison of different signs - Fix compile warnings in hackbench because of warnings about fall through Resolves: rhbz#bz2115067 Signed-off-by: John Kacur <jkacur@redhat.com>
40 lines
1.1 KiB
Diff
40 lines
1.1 KiB
Diff
From a3f7cd235a4aaf7771763d3b0b27d96dd4f5f1c1 Mon Sep 17 00:00:00 2001
|
|
From: John Kacur <jkacur@redhat.com>
|
|
Date: Tue, 1 Nov 2022 09:30:40 -0400
|
|
Subject: [PATCH 1/4] rt-tests: hackbench: Add error checking to connect and
|
|
getsockname
|
|
|
|
Add error checking around the calls connect and getsockname
|
|
|
|
Signed-off-by: John Kacur <jkacur@redhat.com>
|
|
---
|
|
src/hackbench/hackbench.c | 6 ++++--
|
|
1 file changed, 4 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/hackbench/hackbench.c b/src/hackbench/hackbench.c
|
|
index 18c928480103..8c6d83520e57 100644
|
|
--- a/src/hackbench/hackbench.c
|
|
+++ b/src/hackbench/hackbench.c
|
|
@@ -130,14 +130,16 @@ static int inet_socketpair(int fds[2])
|
|
|
|
if (bind(s1, &sin, len) < 0)
|
|
barf("bind");
|
|
- getsockname(s1, &sin, &len);
|
|
+ if (getsockname(s1, &sin, &len) < 0)
|
|
+ barf("getsockname");
|
|
if (listen(s1, 10) < 0)
|
|
barf("listen");
|
|
if (ioctl(s2, FIONBIO, &ul) < 0)
|
|
barf("ioctl");
|
|
if (ioctl(s1, FIONBIO, &ul) < 0)
|
|
barf("ioctl");
|
|
- connect(s2, &sin, len);
|
|
+ if (connect(s2, &sin, len) < 0)
|
|
+ barf("connect");
|
|
if ((fds[0] = accept(s1, &sin, &len)) < 0)
|
|
barf("accept");
|
|
ul = 0;
|
|
--
|
|
2.38.1
|
|
|