If we don't close the fd's we open and are running on NFS we get warnings
like:
tst_rmdir(): rmobj(/tmp/wri7hJN5W) failed:
unlink(/tmp/wri7hJN5W/.nfs0000000002770dc100000001) failed; errno=16: Device or
resource busy
--- ltp-full-20071031.orig/testcases/kernel/syscalls/creat/creat01.c
2007-11-02 03:34:57.000000000 -0500
+++ ltp-full-20071031/testcases/kernel/syscalls/creat/creat01.c 2007-11-09
10:11:47.000000000 -0600
@@ -68,6 +68,7 @@
struct passwd *ltpuser;
char filename[40];
+int fd[2];
#define MODE1 0644
#define MODE2 0444
@@ -107,7 +108,7 @@
/* loop through the test cases */
for (i=0; i<TST_TOTAL; i++) {
- TEST(creat(filename, TC[i].mode));
+ TEST(fd[i] = creat(filename, TC[i].mode));
if (TEST_RETURN == -1) {
tst_resm(TFAIL, "Could not creat file %s",
@@ -202,12 +203,17 @@
void
cleanup()
{
+ int i;
/*
* print timing stats if that option was specified.
* print errno log if that option was specified.
*/
TEST_CLEANUP;
+ for (i=0; i<TST_TOTAL; i++) {
+ close(fd[i]);
+ }
+
unlink(filename);
/* delete the test directory created in setup() */
--- ltp-full-20071031.orig/testcases/kernel/syscalls/open/open04.c
2007-11-02 03:34:58.000000000 -0500
+++ ltp-full-20071031/testcases/kernel/syscalls/open/open04.c 2007-11-09
10:16:51.000000000 -0600
@@ -60,6 +60,7 @@
int fd, ifile, mypid, first;
int nfile;
+int *buf;
char fname[40];
int exp_enos[] = {EMFILE, 0};
@@ -71,7 +72,6 @@
{
int lc; /* loop counter */
char *msg; /* message returned from parse_opts */
- int fdo;
/* parse standard options */
if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
@@ -86,7 +86,6 @@
for (lc = 0; TEST_LOOPING(lc); lc++) {
/* reset Tst_count in case we are looping */
Tst_count = 0;
- int a;
TEST(open(fname, O_RDWR | O_CREAT));
@@ -138,6 +137,11 @@
close(first);
unlink(fname);
+ /* Allocate memory for stat and ustat structure variables*/
+ if( (buf = (int *) malloc(sizeof(int) * nfile - first)) == NULL) {
+ tst_brkm(TBROK, tst_exit, "Failed to allocate Memory");
+ }
+
for (ifile = first; ifile <= nfile; ifile++) {
sprintf(fname, "open04.%d.%d", ifile, mypid);
if ((fd = open(fname, O_RDWR | O_CREAT)) == -1) {
@@ -147,6 +151,7 @@
}
break;
}
+ buf[ifile-first] = fd;
}
}
@@ -167,6 +172,7 @@
for (ifile = first; ifile < nfile; ifile++) {
sprintf(fname, "open04.%d.%d", ifile, mypid);
+ close(buf[ifile-first]);
unlink(fname);
}
--- ltp-full-20071031.orig/testcases/kernel/syscalls/writev/writev06.c
2007-11-02 03:34:58.000000000 -0500
+++ ltp-full-20071031/testcases/kernel/syscalls/writev/writev06.c
2007-11-14 00:23:30.000000000 -0600
@@ -232,6 +232,8 @@
*/
TEST_CLEANUP;
+ close(fd[0]);
+
if (unlink(f_name) < 0) {
tst_resm(TFAIL, "unlink Failed--file = %s, errno = %d",
f_name, errno);
-------------------------------------------------------------------------
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