Skip to contentSkip to conversation

kill05.c: fix fail due to the same pw_uid of ltpuser1 and ltpuser2

PATCH In review Peng Haitao 2 participants 2 messages Mar 8, 2011 – Apr 26, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kill05.c: fix fail due to the same pw_uid of ltpuser1 and ltpuser2

Hi Garrett,

When the macro "SAFE_GETPWNAM" is called twice, the return values are the same. This may cause the case failure.

---
 testcases/kernel/syscalls/kill/kill05.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
testcases/kernel/syscalls/kill/kill05.c +2 -4
index 0193100..6a80597 100644
@@ -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);
Signature · 16 lines
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#1 lore raw

Hi!
Commited, thanks.

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list