setuid/setuid04.c: Fix a double cleanup() error
PATCH 1/1 setuid/setuid04.c: Fix a double cleanup() error
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(-)
testcases/kernel/syscalls/setuid/setuid04.c +5 -1
@@ -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 ; }
Signature · 13 lines
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
Hi!
Quoted 19 lines
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(-)testcases/kernel/syscalls/setuid/setuid04.c +0
-0@@ -175,7 +175,11 @@ static void setup(void)
testcases/kernel/syscalls/setuid/setuid04.c static void setup(void) · line 184
Quoted 10 lines
testcases/kernel/syscalls/setuid/setuid04.c +5
-1static void cleanup (void ) { +char *tmpdir;close (fd); -tst_rmdir (); + tmpdir =get_tst_tmpdir (); +if (!access (tmpdir,F_OK )) +tst_rmdir (); +free (tmpdir);TEST_CLEANUP ;
This is not the best course of action.
It would be better to figure out why the cleanup is executed twice and fix the cause rather than the symptoms.
Signature · 13 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ 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