[1/5] chroot01: Use the 'tmpdir' we create.

Message ID 20181105235019.254846-2-sspatil@google.com
State Accepted
Commit 88dfb97d26ba6cf24d916a3bb5995271a50fe82d
Headers show
Series
  • Misc cleanups (new lib) and fixes for Android
Related show

Commit Message

Sandeep Patil Nov. 5, 2018, 11:50 p.m.
Remove hard coded use of /tmp that breaks this test for Android and use
the tmpdir() we create in the setup() instead.

Signed-off-by: Sandeep Patil <sspatil@google.com>
---
 testcases/kernel/syscalls/chroot/chroot01.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Cyril Hrubis Nov. 6, 2018, 3:45 p.m. | #1
Hi!
Pushed, thanks.

Patch

diff --git a/testcases/kernel/syscalls/chroot/chroot01.c b/testcases/kernel/syscalls/chroot/chroot01.c
index 9b0c30cf1..a1db5e157 100644
--- a/testcases/kernel/syscalls/chroot/chroot01.c
+++ b/testcases/kernel/syscalls/chroot/chroot01.c
@@ -54,7 +54,7 @@  char *TCID = "chroot01";
 int TST_TOTAL = 1;
 int fail;
 
-char path[] = "/tmp";
+char *path;
 
 char nobody_uid[] = "nobody";
 struct passwd *ltpuser;
@@ -94,6 +94,7 @@  void setup(void)
 	tst_require_root();
 
 	tst_tmpdir();
+	path = tst_get_tmpdir();
 
 	if ((ltpuser = getpwnam(nobody_uid)) == NULL)
 		tst_brkm(TBROK | TERRNO, cleanup,
@@ -110,5 +111,6 @@  void cleanup(void)
 {
 	SAFE_SETEUID(NULL, 0);
 
+	free(path);
 	tst_rmdir();
 }