From: Peng Haitao <penght@cn.fujitsu.com>
To: Garrett Cooper <yanegomi@gmail.com>
Cc: ltp-list@lists.sourceforge.net
Subject: [LTP] [PATCH] kill05.c: fix fail due to the same pw_uid of ltpuser1 and ltpuser2
Date: Tue, 08 Mar 2011 13:42:02 +0800 [thread overview]
Message-ID: <4D75C1AA.3020302@cn.fujitsu.com> (raw)
Hi Garrett,
When the macro "SAFE_GETPWNAM" is called twice, the return values are the same.
This may cause the case failure.
Signed-off-by: Peng Haitao <penght@cn.fujitsu.com>
---
testcases/kernel/syscalls/kill/kill05.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/testcases/kernel/syscalls/kill/kill05.c b/testcases/kernel/syscalls/kill/kill05.c
index 0193100..6a80597 100644
--- a/testcases/kernel/syscalls/kill/kill05.c
+++ b/testcases/kernel/syscalls/kill/kill05.c
@@ -143,9 +143,6 @@ void do_master_child(char **av)
struct passwd *ltpuser1, *ltpuser2;
- ltpuser1 = SAFE_GETPWNAM(NULL, user1name);
- ltpuser2 = SAFE_GETPWNAM(NULL, user2name);
-
TEST_EXP_ENOS(exp_enos);
Tst_count = 0;
@@ -158,7 +155,7 @@ void do_master_child(char **av)
tst_brkm(TBROK|TERRNO, cleanup, "Fork failed");
if (pid1 == 0) {
-
+ ltpuser1 = SAFE_GETPWNAM(NULL, user1name);
if (setreuid(ltpuser1->pw_uid, ltpuser1->pw_uid) == -1) {
perror("setreuid failed (in child)");
exit(1);
@@ -172,6 +169,7 @@ void do_master_child(char **av)
do_child();
#endif
}
+ ltpuser2 = SAFE_GETPWNAM(NULL, user2name);
if (setreuid(ltpuser2->pw_uid, ltpuser2->pw_uid) == -1) {
perror("seteuid failed");
exit(1);
--
1.7.1
--
Best Regards,
Peng Haitao
------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next reply other threads:[~2011-03-08 5:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-08 5:42 Peng Haitao [this message]
2011-04-26 16:25 ` [LTP] [PATCH] kill05.c: fix fail due to the same pw_uid of ltpuser1 and ltpuser2 Cyril Hrubis
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=4D75C1AA.3020302@cn.fujitsu.com \
--to=penght@cn.fujitsu.com \
--cc=ltp-list@lists.sourceforge.net \
--cc=yanegomi@gmail.com \
/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