public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] prot_hsymlinks: explicitly close file descriptors
@ 2013-11-01  5:57 Stanislav Kholmanskikh
  2013-11-04 15:26 ` chrubis
  0 siblings, 1 reply; 6+ messages in thread
From: Stanislav Kholmanskikh @ 2013-11-01  5:57 UTC (permalink / raw)
  To: ltp-list; +Cc: vasily.isaenko, alexey.kodanev

This test case does not need to keep the file descriptors
open after doing creat() on them. So we close them right after
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 <stanislav.kholmanskikh@oracle.com>
---
 .../security/prot_hsymlinks/prot_hsymlinks.c       |    2 +-
 1 files changed, 1 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..4c05e3f 100644
--- a/testcases/kernel/security/prot_hsymlinks/prot_hsymlinks.c
+++ b/testcases/kernel/security/prot_hsymlinks/prot_hsymlinks.c
@@ -414,7 +414,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);
+		close(SAFE_CREAT(cleanup, path, 0644));
 	else
 		SAFE_MKDIR(cleanup, path, 0755);
 
-- 
1.7.1


------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-11-06 11:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-01  5:57 [LTP] [PATCH] prot_hsymlinks: explicitly close file descriptors Stanislav Kholmanskikh
2013-11-04 15:26 ` chrubis
     [not found]   ` <5278CF8E.7020104@oracle.com>
2013-11-05 16:46     ` chrubis
2013-11-06  8:23       ` [LTP] [PATCH V2 1/2] Implemented SAFE_TOUCH macro Stanislav Kholmanskikh
2013-11-06 11:03         ` chrubis
2013-11-06  8:23       ` [LTP] [PATCH V2 2/2] prot_hsymlinks: use SAFE_TOUCH Stanislav Kholmanskikh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox