summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2016-01-19 01:38:06 +0000
committerngie <ngie@FreeBSD.org>2016-01-19 01:38:06 +0000
commit30ae8fa920e706d100633af04d887862e4961ac3 (patch)
tree78e211c40433aa1e0ca0c640132403c1612ac4a0 /tools
parent4b07dd5aab89a1b0329e319d41fa237a4e9aba9d (diff)
downloadFreeBSD-src-30ae8fa920e706d100633af04d887862e4961ac3.zip
FreeBSD-src-30ae8fa920e706d100633af04d887862e4961ac3.tar.gz
MFC r294103:
- Check for accf_filter before running the tests, otherwise it will always fail at subtest 9/11 - Use strncpy instead of strcpy with afa.af_name
Diffstat (limited to 'tools')
-rw-r--r--tools/regression/sockets/accf_data_attach/accf_data_attach.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/tools/regression/sockets/accf_data_attach/accf_data_attach.c b/tools/regression/sockets/accf_data_attach/accf_data_attach.c
index 59ea68c..bfcda1a 100644
--- a/tools/regression/sockets/accf_data_attach/accf_data_attach.c
+++ b/tools/regression/sockets/accf_data_attach/accf_data_attach.c
@@ -27,6 +27,7 @@
*/
#include <sys/types.h>
+#include <sys/module.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@ -65,6 +66,16 @@ main(void)
socklen_t len;
int lso, ret;
+ /* XXX: PLAIN_TEST_REQUIRE_MODULE "backport" for stable/9 */
+ const char *_mod_name = "accf_data";
+
+ if (modfind(_mod_name) == -1) {
+ printf("1..0 # SKIP - module %s could not be resolved: %s\n",
+ _mod_name, strerror(errno));
+ _exit(0);
+ }
+ /* XXX: PLAIN_TEST_REQUIRE_MODULE for stable/9 */
+
printf("1..11\n");
/*
@@ -119,7 +130,7 @@ main(void)
* yet a listen() socket.
*/
bzero(&afa, sizeof(afa));
- strcpy(afa.af_name, ACCF_NAME);
+ strncpy(afa.af_name, ACCF_NAME, sizeof(afa.af_name));
ret = setsockopt(lso, SOL_SOCKET, SO_ACCEPTFILTER, &afa, sizeof(afa));
if (ret == 0)
errx(-1, "not ok 5 - setsockopt() before listen() succeeded");
@@ -164,7 +175,7 @@ main(void)
* Step 8: After listen(). This call to setsockopt() should succeed.
*/
bzero(&afa, sizeof(afa));
- strcpy(afa.af_name, ACCF_NAME);
+ strncpy(afa.af_name, ACCF_NAME, sizeof(afa.af_name));
ret = setsockopt(lso, SOL_SOCKET, SO_ACCEPTFILTER, &afa, sizeof(afa));
if (ret != 0)
errx(-1, "not ok 9 - setsockopt() after listen() failed with %d "
OpenPOWER on IntegriCloud