Missed this the first go around.

- k

--- testcases/kernel/syscalls/creat/creat05.c   2007-11-09  
06:12:45.000000000 -0600
+++ ../ltp-full-20071031/testcases/kernel/syscalls/creat/ 
creat05.c      2007-11-09 04:23:56.000000000 -0600
@@ -68,6 +68,7 @@
int exp_enos[] = {EMFILE, 0};
int fd, ifile, mypid, first;
+int *buf;
char fname[40];
int
@@ -151,6 +152,11 @@
         /* get the maximum number of files that we can open */
         max_open = getdtablesize();
+       /* Allocate memory for stat and ustat structure variables*/
+       if( (buf = (int *) malloc(sizeof(int) *  max_open - first))  
== NULL) {
+               tst_brkm(TBROK, tst_exit, "Failed to allocate Memory");
+       }
+
         /* now open as many files as we can up to max_open */
         for (ifile = first; ifile <= max_open; ifile++) {
                 sprintf(fname, "creat05.%d.%d", ifile, mypid);
@@ -164,6 +170,7 @@
                         }
                         break;
                 }
+               buf[ifile-first] = fd;
         }
}
@@ -177,6 +184,7 @@
         for (i=first; i<nfiles; i++) {
                 sprintf(fname, "creat05.%d.%d", i, mypid);
+               close(buf[i-first]);
                 unlink(fname);
         }
}

-------------------------------------------------------------------------
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