This test case does not need to keep the file descriptors
open after doing creat() on them. So we use SAFE_TOUCH instead
of SAFE_CREAT.

Otherwise on NFS it outputs:

TWARN  :  tst_rmdir: rmobj(/tmpdir/ltp-vdIWJBmrkz/provfaUSg) failed: 
remove(/tmpdir/ltp-vdIWJBmrkz/provfaUSg/tmp_root/hsym) failed; errno=66: 
Directory not empty

or:
TWARN  :  tst_rmdir: rmobj(/mnt/proXZmq0T) failed: 
unlink(/mnt/proXZmq0T/root/.nfs00000000000008470000015e) failed; errno=16: 
Device or resource busy

The same idea as for 8c200cb8e843724afb49fa6617fceec09ac826a5.

Signed-off-by: Stanislav Kholmanskikh <[email protected]>
---
 .../security/prot_hsymlinks/prot_hsymlinks.c       |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/testcases/kernel/security/prot_hsymlinks/prot_hsymlinks.c 
b/testcases/kernel/security/prot_hsymlinks/prot_hsymlinks.c
index 558681a..e9948e3 100644
--- a/testcases/kernel/security/prot_hsymlinks/prot_hsymlinks.c
+++ b/testcases/kernel/security/prot_hsymlinks/prot_hsymlinks.c
@@ -45,6 +45,7 @@
 #include "test.h"
 #include "usctest.h"
 #include "safe_macros.h"
+#include "safe_file_ops.h"
 
 char *TCID = "prot_hsymlinks";
 int TST_TOTAL = 396;
@@ -414,7 +415,7 @@ static void ufiles_add(int usr, char *path, int type)
        struct user_file *ufile = &users[usr].file[file];
 
        if (type == IS_FILE)
-               SAFE_CREAT(cleanup, path, 0644);
+               SAFE_TOUCH(cleanup, path, 0644, NULL);
        else
                SAFE_MKDIR(cleanup, path, 0755);
 
-- 
1.7.1


------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to