Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Dec 2005 23:57:42 GMT
From:      Wayne Salamon <wsalamon@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 87662 for review
Message-ID:  <200512022357.jB2NvgRr091984@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=87662

Change 87662 by wsalamon@gretsch on 2005/12/02 23:57:14

	Add a test case for a failed FCHDIR record. Clean up some other things.

Affected files ...

.. //depot/projects/trustedbsd/audit3/tools/regression/audit/test/file/tdir.c#4 edit

Differences ...

==== //depot/projects/trustedbsd/audit3/tools/regression/audit/test/file/tdir.c#4 (text+ko) ====

@@ -25,12 +25,13 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  */
+#include <sys/stat.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
 #include <audittest.h>
 #include <dirent.h>
 #include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/syscall.h>
-#include <sys/types.h>
+#include <unistd.h>
 
 /*
  * Test the auditing of some of the dir-related system calls.
@@ -61,6 +62,7 @@
 
 	/* The next calls should generate AUE_CHDIR audit records */
 	chdir(tempname);	
+	/* This next call is necessasry so we can find the audit log file. */
 	chdir("..");	
 	aut_assert(AUE_CHDIR);
 
@@ -78,8 +80,11 @@
 
 	/* The next calls should generate AUE_FCHDIR audit records */
 	fchdir(temp_fd);	
-	temp_fd = dirfd(opendir(".."));
-	fchdir(temp_fd);	
+	chdir("..");	
+	aut_assert(AUE_FCHDIR);
+
+	/* Generate a failure AUE_FCHDIR record */
+	fchdir(999);	
 	aut_assert(AUE_FCHDIR);
 
 	/* The next call should generate a AUE_RMDIR audit record */



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