Hi!
> 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 <[email protected]>
> ---
>  .../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);
>  

There is quite a lot of places in LTP where we do creat() and then
close(), what about adding SAFE_TOUCH() with touch(1) sematics to the
safe_file_ops.h in LTP lib?

-- 
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to