public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] [4/4] syscalls/chroot04: Convert to new API
Date: Mon, 9 Aug 2021 16:28:38 +0200	[thread overview]
Message-ID: <YRE7luQRhPpa3TbT@yuki> (raw)
In-Reply-To: <20210806040046.18836-1-zhanglianjie@uniontech.com>

Hi!
Pushed with similar changes as in chroot01.c, thanks.

Full diff:

diff --git a/testcases/kernel/syscalls/chroot/chroot04.c b/testcases/kernel/syscalls/chroot/chroot04.c
index b65b09d79..ed0f66323 100644
--- a/testcases/kernel/syscalls/chroot/chroot04.c
+++ b/testcases/kernel/syscalls/chroot/chroot04.c
@@ -7,9 +7,13 @@
   */
 
 /*\
- * [DESCRIPTION]
+ * [Description]
  *
- *	Testcase to check that chroot sets errno to EACCES.
+ * Testcase to check that chroot sets errno to EACCES.
+ *
+ * As a non-root user attempt to perform chroot() to a directory that the user
+ * does not have a search permission for. The chroot() call should fail with
+ * EACESS.
  */
 
 #include <stdio.h>
@@ -17,21 +21,19 @@
 #include "tst_test.h"
 
 #define TEST_TMPDIR	"chroot04_tmpdir"
-static char nobody_uid[] = "nobody";
-static struct passwd *ltpuser;
 
 static void verify_chroot(void)
 {
-	TST_EXP_FAIL(chroot(TEST_TMPDIR), EACCES, "got EACCESS as expected");
+	TST_EXP_FAIL(chroot(TEST_TMPDIR), EACCES, "no search permission chroot()");
 }
 
 static void setup(void)
 {
-	/*
-	 * create a temporary directory
-	 */
+	struct passwd *ltpuser;
+
 	SAFE_MKDIR(TEST_TMPDIR, 0222);
-	ltpuser = SAFE_GETPWNAM(nobody_uid);
+
+	ltpuser = SAFE_GETPWNAM("nobody");
 	SAFE_SETEUID(ltpuser->pw_uid);
 }
 

-- 
Cyril Hrubis
chrubis@suse.cz

      reply	other threads:[~2021-08-09 14:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-06  4:00 [LTP] [PATCH] [4/4] syscalls/chroot04: Convert to new API zhanglianjie
2021-08-09 14:28 ` Cyril Hrubis [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YRE7luQRhPpa3TbT@yuki \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox