On some systems which do not support 16-bit version syscall,
the cleanup() will be called twice in this case leading to
a case failure.

This patch makes sure calling tst_rmdir() only when the temp dir
still exists.

Signed-off-by: Ma Shimiao <[email protected]>
Signed-off-by: Zeng Linggang <[email protected]>
---
  testcases/kernel/syscalls/setuid/setuid04.c |    6 +++++-
  1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/testcases/kernel/syscalls/setuid/setuid04.c 
b/testcases/kernel/syscalls/setuid/setuid04.c
index d8e991e..4f2cabd 100644
--- a/testcases/kernel/syscalls/setuid/setuid04.c
+++ b/testcases/kernel/syscalls/setuid/setuid04.c
@@ -175,7 +175,11 @@ static void setup(void)
  
  static void cleanup(void)
  {
+       char *tmpdir;
        close(fd);
-       tst_rmdir();
+       tmpdir = get_tst_tmpdir();
+       if (!access(tmpdir, F_OK))
+               tst_rmdir();
+       free(tmpdir);
        TEST_CLEANUP;
  }
-- 
1.7.1


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to