From: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
To: ltp-list@lists.sourceforge.net
Subject: [LTP] [PATCH] chroot/chroot03.c: add ELOOP error value test for chroot(2)
Date: Thu, 31 Oct 2013 10:15:05 +0800 [thread overview]
Message-ID: <5271BD29.6080701@cn.fujitsu.com> (raw)
Subject: [PATCH] chroot/chroot03.c: add ELOOP error value test for chroot(2)
Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
---
testcases/kernel/syscalls/chroot/chroot03.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/testcases/kernel/syscalls/chroot/chroot03.c b/testcases/kernel/syscalls/chroot/chroot03.c
index c34d8ea..a4cd209 100644
--- a/testcases/kernel/syscalls/chroot/chroot03.c
+++ b/testcases/kernel/syscalls/chroot/chroot03.c
@@ -43,6 +43,10 @@
* The pathname parameter to chroot() points to an invalid address,
* chroot(2) fails with EPERM.
*
+ * 5. Test for ELOOP:
+ * Too many symbolic links were encountered When resolving the
+ * pathname parameter.
+ *
* USAGE: <for command-line>
* chroot03 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
* where, -c n : Run n copies concurrently.
@@ -66,6 +70,7 @@
#include "test.h"
#include "usctest.h"
#include <fcntl.h>
+#include "safe_macros.h"
char *TCID = "chroot03";
@@ -74,8 +79,9 @@ char fname[255];
char good_dir[100] = "/tmp/testdir";
char bad_dir[] =
"abcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyz";
+char symbolic_dir[] = "sym_dir1";
-int exp_enos[] = { ENAMETOOLONG, ENOENT, ENOTDIR, EFAULT, 0 };
+int exp_enos[] = { ENAMETOOLONG, ENOENT, ENOTDIR, EFAULT, ELOOP, 0 };
struct test_case_t {
char *dir;
@@ -105,8 +111,9 @@ struct test_case_t {
* and expect EFAULT as errno
*/
{
- (char *)-1, EFAULT}
+ (char *)-1, EFAULT},
#endif
+ {symbolic_dir, ELOOP}
};
int TST_TOTAL = (sizeof(TC) / sizeof(*TC));
@@ -196,6 +203,12 @@ void setup()
}
TC[3].dir = bad_addr;
#endif
+ /*
+ * create two symbolic directory who point to each other to
+ * test ELOOP.
+ */
+ SAFE_SYMLINK(cleanup, "sym_dir1/", "sym_dir2");
+ SAFE_SYMLINK(cleanup, "sym_dir2/", "sym_dir1");
}
/*
--
1.8.2.1
------------------------------------------------------------------------------
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next reply other threads:[~2013-10-31 2:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-31 2:15 Xiaoguang Wang [this message]
2013-10-31 8:43 ` [LTP] [PATCH] chroot/chroot03.c: add ELOOP error value test for chroot(2) Wanlong Gao
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=5271BD29.6080701@cn.fujitsu.com \
--to=wangxg.fnst@cn.fujitsu.com \
--cc=ltp-list@lists.sourceforge.net \
/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