* [LTP] [PATCH] chroot/chroot03.c: add ELOOP error value test for chroot(2)
@ 2013-10-31 2:15 Xiaoguang Wang
2013-10-31 8:43 ` Wanlong Gao
0 siblings, 1 reply; 2+ messages in thread
From: Xiaoguang Wang @ 2013-10-31 2:15 UTC (permalink / raw)
To: ltp-list
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [LTP] [PATCH] chroot/chroot03.c: add ELOOP error value test for chroot(2)
2013-10-31 2:15 [LTP] [PATCH] chroot/chroot03.c: add ELOOP error value test for chroot(2) Xiaoguang Wang
@ 2013-10-31 8:43 ` Wanlong Gao
0 siblings, 0 replies; 2+ messages in thread
From: Wanlong Gao @ 2013-10-31 8:43 UTC (permalink / raw)
To: Xiaoguang Wang, ltp-list
On 10/31/2013 10:15 AM, Xiaoguang Wang wrote:
> 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(-)
Applied, thank you.
Wanlong gao
------------------------------------------------------------------------------
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-10-31 8:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-31 2:15 [LTP] [PATCH] chroot/chroot03.c: add ELOOP error value test for chroot(2) Xiaoguang Wang
2013-10-31 8:43 ` Wanlong Gao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox