PERFORCE change 87662 for review
    Wayne Salamon 
    wsalamon at FreeBSD.org
       
    Fri Dec  2 23:57:44 GMT 2005
    
    
  
http://perforce.freebsd.org/chv.cgi?CH=87662
Change 87662 by wsalamon at 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 */
    
    
More information about the p4-projects
mailing list