Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Jan 2016 01:39:29 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r294304 - stable/9/tools/regression/sockets/accf_data_attach
Message-ID:  <201601190139.u0J1dTup084812@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Tue Jan 19 01:39:29 2016
New Revision: 294304
URL: https://svnweb.freebsd.org/changeset/base/294304

Log:
  MFstable/10 r294303:
  
  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

Modified:
  stable/9/tools/regression/sockets/accf_data_attach/accf_data_attach.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/tools/   (props changed)
  stable/9/tools/regression/   (props changed)
  stable/9/tools/regression/sockets/   (props changed)

Modified: stable/9/tools/regression/sockets/accf_data_attach/accf_data_attach.c
==============================================================================
--- stable/9/tools/regression/sockets/accf_data_attach/accf_data_attach.c	Tue Jan 19 01:38:06 2016	(r294303)
+++ stable/9/tools/regression/sockets/accf_data_attach/accf_data_attach.c	Tue Jan 19 01:39:29 2016	(r294304)
@@ -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(int argc, char *argv[])
 	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(int argc, char *argv[])
 	 * 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(int argc, char *argv[])
 	 * 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 "



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601190139.u0J1dTup084812>