Skip to contentSkip to conversation

syscalls/bind: Use safe_macros to check the return value of the close() & bind().

PATCH New Xie Ziyao 2 participants 2 messages Mar 24, 2021 – Apr 1, 2021

lore
Share & tools
lore

Xie Ziyao

author
#0 lore raw

PATCH 1/1 syscalls/bind: Use safe_macros to check the return value of the close() & bind().

For those:
testcases/kernel/syscalls/bind/bind03.c
testcases/kernel/syscalls/bind/bind06.c

---
 testcases/kernel/syscalls/bind/bind03.c | 4 ++--
 testcases/kernel/syscalls/bind/bind06.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
testcases/kernel/syscalls/bind/bind03.c +2 -2
index c39e8f197..ebde19591 100644
@@ -66,8 +66,8 @@ void run(void)
 
 static void cleanup(void)
 {
-	close(sock1);
-	close(sock2);
+	SAFE_CLOSE(sock1);
+	SAFE_CLOSE(sock2);
 }
 
 static struct tst_test test = {
testcases/kernel/syscalls/bind/bind06.c +2 -2
index e971a8940..017e0fc89 100644
@@ -60,8 +60,8 @@ static void cleanup(void)
 
 static void do_bind(void)
 {
-	bind(fd, (struct sockaddr *)&addr1, sizeof(addr1));
-	bind(fd, (struct sockaddr *)&addr2, sizeof(addr2));
+	SAFE_BIND(fd, (struct sockaddr *)&addr1, sizeof(addr1));
+	SAFE_BIND(fd, (struct sockaddr *)&addr2, sizeof(addr2));
 }
 
 static void *thread_run(void *arg)

--
2.17.1

#1 lore raw

PATCH 1/1 syscalls/bind: Use safe_macros to check the return value of the close() & bind().

Hi Ziyao,

Thanks merged!

Kind regards,
Petr