Skip to contentSkip to conversation

Fix cleanup procedure in the setuid04 test

PATCH Subrata Modak 2 participants 4 messages Jun 23, 2009 – Jun 25, 2009 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 5 lines · Jiri Palecek

Cleanup has to be made only once in the parent process; when the
child makes the cleanup itself, the parent has nothing to cleanup, which makes him sad.

Thanks.

Regards--
Subrata

Quoted 31 lines
---
 testcases/kernel/syscalls/setuid/setuid04.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
testcases/kernel/syscalls/setuid/setuid04.c +2 -3
index 18f1d90..26a3868 100644
@@ -114,7 +114,7 @@ void do_master_child()
 	int status;
 
 	if (setuid(ltpuser->pw_uid) == -1) {
-		tst_brkm(TBROK, cleanup,
+		tst_brkm(TBROK, tst_exit,
 			 "setuid failed to set the effective uid to %d",
 			 ltpuser->pw_uid);
 	}
@@ -143,7 +143,7 @@ void do_master_child()
 
 		pid = FORK_OR_VFORK();
 		if (pid < 0)
-			tst_brkm(TBROK, cleanup, "Fork failed");
+			tst_brkm(TBROK, tst_exit, "Fork failed");
 
 		if (pid == 0) {
 			int tst_fd2;
@@ -160,13 +160,12 @@ void do_master_child()
 
 			if (TEST_ERRNO == EACCES) {
 				tst_resm(TPASS, "open returned errno EACCES");
-				exit(0);

testcases/kernel/syscalls/setuid/setuid04.c void do_master_child() · line 171

Quoted 10 lines
testcases/kernel/syscalls/setuid/setuid04.c +1 -1
 			} else {
 				tst_resm(TFAIL,
 					 "open returned unexpected errno - %d",
 					 TEST_ERRNO);
-				exit(-1);
 			}
+			tst_exit();
 		} else {
 			/* Wait for son completion */
 			waitpid(pid, &status, 0);

------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference! Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250. Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#2 lore raw
Quoted 8 lines · Subrata Modak
Quoted 5 lines · Jiri Palecek

Cleanup has to be made only once in the parent process; when the
child makes the cleanup itself, the parent has nothing to cleanup, which makes him sad.

Thanks.

Oh no, at the second sight I see I've posted a wrong (old) version of the patch. I'll send a correction shortly.

Sorry for the buzz

Jiri Palecek

Quoted 43 lines
Quoted 42 lines
---
 testcases/kernel/syscalls/setuid/setuid04.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
testcases/kernel/syscalls/setuid/setuid04.c +3 -4
index 18f1d90..26a3868 100644
@@ -114,7 +114,7 @@ void do_master_child()
 	int status;
 
 	if (setuid(ltpuser->pw_uid) == -1) {
-		tst_brkm(TBROK, cleanup,
+		tst_brkm(TBROK, tst_exit,
 			 "setuid failed to set the effective uid to %d",
 			 ltpuser->pw_uid);
 	}
@@ -143,7 +143,7 @@ void do_master_child()
 
 		pid = FORK_OR_VFORK();
 		if (pid < 0)
-			tst_brkm(TBROK, cleanup, "Fork failed");
+			tst_brkm(TBROK, tst_exit, "Fork failed");
 
 		if (pid == 0) {
 			int tst_fd2;
@@ -160,13 +160,12 @@ void do_master_child()
 
 			if (TEST_ERRNO == EACCES) {
 				tst_resm(TPASS, "open returned errno EACCES");
-				exit(0);
 			} else {
 				tst_resm(TFAIL,
 					 "open returned unexpected errno - %d",
 					 TEST_ERRNO);
-				exit(-1);
 			}
+			tst_exit();
 		} else {
 			/* Wait for son completion */
 			waitpid(pid, &status, 0);
Signature · 11 lines
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#3 lore raw
Quoted 7 lines · Jiří Paleček
Quoted 5 lines · Subrata Modak
Quoted 4 lines · Jiri Palecek

Cleanup has to be made only once in the parent process; when the
child makes the cleanup itself, the parent has nothing to cleanup, which makes him sad.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Thanks.

Oh no, at the second sight I see I've posted a wrong (old) version of the patch. I'll send a correction shortly.

The correction is in the attachment. Please, apply.

Regards
Jiri Palecek

Quoted 45 lines
Quoted 42 lines
Quoted 41 lines
---
 testcases/kernel/syscalls/setuid/setuid04.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
testcases/kernel/syscalls/setuid/setuid04.c +3 -4
index 18f1d90..26a3868 100644
@@ -114,7 +114,7 @@ void do_master_child()
 	int status;
 
 	if (setuid(ltpuser->pw_uid) == -1) {
-		tst_brkm(TBROK, cleanup,
+		tst_brkm(TBROK, tst_exit,
 			 "setuid failed to set the effective uid to %d",
 			 ltpuser->pw_uid);
 	}
@@ -143,7 +143,7 @@ void do_master_child()
 
 		pid = FORK_OR_VFORK();
 		if (pid < 0)
-			tst_brkm(TBROK, cleanup, "Fork failed");
+			tst_brkm(TBROK, tst_exit, "Fork failed");
 
 		if (pid == 0) {
 			int tst_fd2;
@@ -160,13 +160,12 @@ void do_master_child()
 
 			if (TEST_ERRNO == EACCES) {
 				tst_resm(TPASS, "open returned errno EACCES");
-				exit(0);
 			} else {
 				tst_resm(TFAIL,
 					 "open returned unexpected errno - %d",
 					 TEST_ERRNO);
-				exit(-1);
 			}
+			tst_exit();
 		} else {
 			/* Wait for son completion */
 			waitpid(pid, &status, 0);
Signature · 1 line
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

------------------------------------------------------------------------------

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#4 lore raw
Quoted 10 lines · Jiří Paleček
Quoted 8 lines · Jiří Paleček
Quoted 5 lines · Subrata Modak
Quoted 4 lines · Jiri Palecek

Cleanup has to be made only once in the parent process; when the
child makes the cleanup itself, the parent has nothing to cleanup, which makes him sad.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Thanks.

Oh no, at the second sight I see I've posted a wrong (old) version of the patch. I'll send a correction shortly.

The correction is in the attachment. Please, apply.

Everythings fine except:

(Stripping trailing CRs from patch.)
patching file testcases/kernel/syscalls/setuid/setuid04.c

Regards--
Subrata

Quoted 42 lines

Regards
Jiri Palecek

Quoted 38 lines
Quoted 38 lines
Quoted 38 lines
---
 testcases/kernel/syscalls/setuid/setuid04.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
testcases/kernel/syscalls/setuid/setuid04.c +2 -4
index 18f1d90..26a3868 100644
@@ -114,7 +114,7 @@ void do_master_child()
 	int status;
 
 	if (setuid(ltpuser->pw_uid) == -1) {
-		tst_brkm(TBROK, cleanup,
+		tst_brkm(TBROK, tst_exit,
 			 "setuid failed to set the effective uid to %d",
 			 ltpuser->pw_uid);
 	}
@@ -143,7 +143,7 @@ void do_master_child()
 
 		pid = FORK_OR_VFORK();
 		if (pid < 0)
-			tst_brkm(TBROK, cleanup, "Fork failed");
+			tst_brkm(TBROK, tst_exit, "Fork failed");
 
 		if (pid == 0) {
 			int tst_fd2;
@@ -160,13 +160,12 @@ void do_master_child()
 
 			if (TEST_ERRNO == EACCES) {
 				tst_resm(TPASS, "open returned errno EACCES");
-				exit(0);
 			} else {
 				tst_resm(TFAIL,
 					 "open returned unexpected errno - %d",
 					 TEST_ERRNO);
-				exit(-1);
 			}
Quoted 13 lines
Quoted 8 lines
Quoted 5 lines
Quoted 4 lines
testcases/kernel/syscalls/setuid/setuid04.c +1 -0
+			tst_exit();
 		} else {
 			/* Wait for son completion */
 			waitpid(pid, &status, 0);
Signature · 1 line
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list