git: 942d05e3b898 - main - tests/sys/net/epair: don't leak the interface after the test

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Thu, 27 Jan 2022 05:09:35 UTC
The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=942d05e3b8988c3b78a00d81f8fc7ea668455caa

commit 942d05e3b8988c3b78a00d81f8fc7ea668455caa
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2022-01-27 05:08:50 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2022-01-27 05:08:50 +0000

    tests/sys/net/epair:    don't leak the interface after the test
---
 tests/sys/net/if_epair.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/sys/net/if_epair.c b/tests/sys/net/if_epair.c
index e6864d3ebf93..f38e469b4200 100644
--- a/tests/sys/net/if_epair.c
+++ b/tests/sys/net/if_epair.c
@@ -64,7 +64,11 @@ ATF_TC_BODY(params, tc)
 	ifr.ifr_data = (caddr_t)-1;
         (void) strlcpy(ifr.ifr_name, "epair", sizeof(ifr.ifr_name));
 
-	ioctl(s, SIOCIFCREATE2, &ifr);
+	if (ioctl(s, SIOCIFCREATE2, &ifr) < 0)
+		atf_tc_fail("Failed to create interface");
+
+	if (ioctl(s, SIOCIFDESTROY, &ifr) < 0)
+		atf_tc_fail("Failed to destroy interface");
 }
 
 ATF_TP_ADD_TCS(tp)