[PATCH 2/8] rt-tests: hackbench: Add error checking to connect and getsockname

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add error checking around the calls connect and getsockname

Signed-off-by: John Kacur <jkacur@xxxxxxxxxx>
---
 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




[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux