Hi all,

Please see the attached patches from [EMAIL PROTECTED] for handling file descriptors.

Regards--
Subrata


--- mkdir03.c.old	2007-08-22 09:48:02.000000000 -0400
+++ mkdir03.c	2007-08-22 09:48:54.000000000 -0400
@@ -85,7 +85,7 @@
 #define NAMELEN		50
 
 char *TCID = "mkdir03";           /* Test program identifier.    */
-int fileHandle = 0;
+int fileHandle, fileHandle2 = 0;
 extern int Tst_count;           /* Test Case counter for tst_* routines */
 
 char tstdir3[NAMELEN];
@@ -253,7 +253,7 @@
 	sprintf(tstdir5, "%s/tst",tstfile5);
 
 	/* create a file */
-	if (creat(tstfile5, PERMS) == -1) {
+	if ((fileHandle2 = creat(tstfile5, PERMS)) == -1) {
 		tst_brkm(TBROK, cleanup, "creat a file failed");
 		/*NOTREACHED*/
 	}
@@ -296,7 +296,8 @@
 	 * print timing stats if that option was specified.
 	 * print errno log if that option was specified.
 	 */
-    close(fileHandle);
+	close(fileHandle);
+	close(fileHandle2);
 
 	TEST_CLEANUP;
 
--- mmap09.c.old	2007-08-22 09:57:40.000000000 -0400
+++ mmap09.c	2007-08-22 09:57:56.000000000 -0400
@@ -149,6 +149,7 @@
 
 void cleanup() {
 	TEST_CLEANUP;
+	munmap(maddr, (size_t)mapsize);
 	close(fd);
 	tst_rmdir();
 	tst_exit();
--- open07.c.old	2007-08-22 09:54:00.000000000 -0400
+++ open07.c	2007-08-22 10:05:41.000000000 -0400
@@ -74,6 +74,7 @@
 char *TCID = "open07";
 int TST_TOTAL = 4;
 extern int Tst_count;
+int fd1, fd2;
 
 char file1[100], file2[100], file3[100];
 
@@ -158,7 +159,7 @@
 {
 	sprintf(file1, "open03.1.%d", getpid());
 	sprintf(file2, "open03.2.%d", getpid());
-	if (creat(file1, 00700) < 0) {
+	if ((fd1 = creat(file1, 00700)) < 0) {
 		tst_brkm(TBROK, cleanup, "creat(2) failed: errno: %d", errno);
 		/*NOTREACHED*/
 	}
@@ -189,7 +190,7 @@
 	sprintf(file1, "open03.5.%d", getpid());
 	sprintf(file2, "open03.6.%d", getpid());
 	sprintf(file3, "open03.7.%d", getpid());
-	if (creat(file1, 00700) < 0) {
+	if ((fd2 = creat(file1, 00700)) < 0) {
 		tst_brkm(TBROK, cleanup, "creat(2) failed: errno: %d", errno);
 		/*NOTREACHED*/
 	}
@@ -253,6 +254,8 @@
 	 * print errno log if that option was specified
 	 */
 	TEST_CLEANUP;
+	close(fd1);
+	close(fd2);
 
 	/* Remove tmp dir and all files in it */
 	tst_rmdir();
--- sendfile03.c.old	2007-08-22 09:52:22.000000000 -0400
+++ sendfile03.c	2007-08-22 09:52:26.000000000 -0400
@@ -187,7 +187,8 @@
 	 * print timing stats if that option was specified.
 	 * print errno log if that option was specified.
 	 */
-    close(out_fd);
+	close(out_fd);
+	close(in_fd);
 
 	TEST_CLEANUP;
 
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to