public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] Fix cleanup procedure in the setuid04 test
@ 2009-05-12 17:06 Jiri Palecek
  0 siblings, 0 replies; 5+ messages in thread
From: Jiri Palecek @ 2009-05-12 17:06 UTC (permalink / raw)
  Cc: ltp-list

 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.

Signed-off-by: Jiri Palecek <jpalecek@web.de>
---
 testcases/kernel/syscalls/setuid/setuid04.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/testcases/kernel/syscalls/setuid/setuid04.c b/testcases/kernel/syscalls/setuid/setuid04.c
index 18f1d90..26a3868 100644
--- a/testcases/kernel/syscalls/setuid/setuid04.c
+++ b/testcases/kernel/syscalls/setuid/setuid04.c
@@ -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);
-- 
1.6.3.1




------------------------------------------------------------------------------
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH] Fix cleanup procedure in the setuid04 test
       [not found] <200906220117.n5M1HTVJ004183@e2.ny.us.ibm.com>
@ 2009-06-23 14:49 ` Subrata Modak
  2009-06-23 15:41   ` Jiří Paleček
  0 siblings, 1 reply; 5+ messages in thread
From: Subrata Modak @ 2009-06-23 14:49 UTC (permalink / raw)
  To: Jiri Palecek; +Cc: ltp-list

On Tue, 2009-05-12 at 19:06 +0200, Jiri Palecek wrote: 
> 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.
> 
> Signed-off-by: Jiri Palecek <jpalecek@web.de>

Thanks.

Regards--
Subrata

> ---
>  testcases/kernel/syscalls/setuid/setuid04.c |    7 +++----
>  1 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/setuid/setuid04.c b/testcases/kernel/syscalls/setuid/setuid04.c
> index 18f1d90..26a3868 100644
> --- a/testcases/kernel/syscalls/setuid/setuid04.c
> +++ b/testcases/kernel/syscalls/setuid/setuid04.c
> @@ -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);


------------------------------------------------------------------------------
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH] Fix cleanup procedure in the setuid04 test
  2009-06-23 14:49 ` [LTP] [PATCH] Fix cleanup procedure in the setuid04 test Subrata Modak
@ 2009-06-23 15:41   ` Jiří Paleček
  2009-06-23 20:48     ` Jiří Paleček
  0 siblings, 1 reply; 5+ messages in thread
From: Jiří Paleček @ 2009-06-23 15:41 UTC (permalink / raw)
  To: subrata; +Cc: ltp-list

On Tue, 23 Jun 2009 16:49:03 +0200, Subrata Modak  
<subrata@linux.vnet.ibm.com> wrote:

> On Tue, 2009-05-12 at 19:06 +0200, Jiri Palecek wrote:
>> 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.
>>
>> Signed-off-by: Jiri Palecek <jpalecek@web.de>
>
> 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

>> ---
>>  testcases/kernel/syscalls/setuid/setuid04.c |    7 +++----
>>  1 files changed, 3 insertions(+), 4 deletions(-)
>>
>> diff --git a/testcases/kernel/syscalls/setuid/setuid04.c  
>> b/testcases/kernel/syscalls/setuid/setuid04.c
>> index 18f1d90..26a3868 100644
>> --- a/testcases/kernel/syscalls/setuid/setuid04.c
>> +++ b/testcases/kernel/syscalls/setuid/setuid04.c
>> @@ -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);
>



-- 
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH] Fix cleanup procedure in the setuid04 test
  2009-06-23 15:41   ` Jiří Paleček
@ 2009-06-23 20:48     ` Jiří Paleček
  2009-06-25  9:10       ` Subrata Modak
  0 siblings, 1 reply; 5+ messages in thread
From: Jiří Paleček @ 2009-06-23 20:48 UTC (permalink / raw)
  To: Jiří Paleček, subrata; +Cc: ltp-list

[-- Attachment #1: Type: text/plain, Size: 2139 bytes --]

On Tue, 23 Jun 2009 17:41:15 +0200, Jiří Paleček <jpalecek@web.de> wrote:

> On Tue, 23 Jun 2009 16:49:03 +0200, Subrata Modak  
> <subrata@linux.vnet.ibm.com> wrote:
>
>> On Tue, 2009-05-12 at 19:06 +0200, Jiri Palecek wrote:
>>> 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.
>>>
>>> Signed-off-by: Jiri Palecek <jpalecek@web.de>
>>
>> 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

>>> ---
>>>  testcases/kernel/syscalls/setuid/setuid04.c |    7 +++----
>>>  1 files changed, 3 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/testcases/kernel/syscalls/setuid/setuid04.c  
>>> b/testcases/kernel/syscalls/setuid/setuid04.c
>>> index 18f1d90..26a3868 100644
>>> --- a/testcases/kernel/syscalls/setuid/setuid04.c
>>> +++ b/testcases/kernel/syscalls/setuid/setuid04.c
>>> @@ -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);
>>
>
>
>



-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

[-- Attachment #2: [PATCH] Fix cleanup procedure in the setuid04 test.mbs --]
[-- Type: application/octet-stream, Size: 1054 bytes --]

From <jirka@debian. Tue May 12 17:06:15 2009
From: "Jiri Palecek >" <"<jirka"@debian.> (none)
Date: Tue, 12 May 2009 19:06:15 +0200
Subject: [PATCH] Fix cleanup procedure in the setuid04 test
Cc: ltp-list@lists.sourceforge.net

 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.

Add a tst_exit to the end of the child procedure, to make it not return and call cleanup (which would be otherwise called twice)

Signed-off-by: Jiri Palecek <jpalecek@web.de>
---
 testcases/kernel/syscalls/setuid/setuid04.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/testcases/kernel/syscalls/setuid/setuid04.c b/testcases/kernel/syscalls/setuid/setuid04.c
index 26a3868..97efbcb 100644
--- a/testcases/kernel/syscalls/setuid/setuid04.c
+++ b/testcases/kernel/syscalls/setuid/setuid04.c
@@ -173,6 +173,7 @@ void do_master_child()
 				exit(WEXITSTATUS(status));
 		}
 	}
+	tst_exit();
 }
 
 /*
-- 
1.6.3.1


[-- Attachment #3: Type: text/plain, Size: 79 bytes --]

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

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH] Fix cleanup procedure in the setuid04 test
  2009-06-23 20:48     ` Jiří Paleček
@ 2009-06-25  9:10       ` Subrata Modak
  0 siblings, 0 replies; 5+ messages in thread
From: Subrata Modak @ 2009-06-25  9:10 UTC (permalink / raw)
  To: Jiri Palecek; +Cc: ltp-list

On Tue, 2009-06-23 at 22:48 +0200, Jiří Paleček wrote: 
> On Tue, 23 Jun 2009 17:41:15 +0200, Jiří Paleček <jpalecek@web.de> wrote:
> 
> > On Tue, 23 Jun 2009 16:49:03 +0200, Subrata Modak  
> > <subrata@linux.vnet.ibm.com> wrote:
> >
> >> On Tue, 2009-05-12 at 19:06 +0200, Jiri Palecek wrote:
> >>> 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.
> >>>
> >>> Signed-off-by: Jiri Palecek <jpalecek@web.de>
> >>
> >> 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

> 
> Regards
>      Jiri Palecek
> 
> >>> ---
> >>>  testcases/kernel/syscalls/setuid/setuid04.c |    7 +++----
> >>>  1 files changed, 3 insertions(+), 4 deletions(-)
> >>>
> >>> diff --git a/testcases/kernel/syscalls/setuid/setuid04.c  
> >>> b/testcases/kernel/syscalls/setuid/setuid04.c
> >>> index 18f1d90..26a3868 100644
> >>> --- a/testcases/kernel/syscalls/setuid/setuid04.c
> >>> +++ b/testcases/kernel/syscalls/setuid/setuid04.c
> >>> @@ -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);
> >>
> >
> >
> >
> 
> 
> 
> -- 
> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/


------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-06-25 10:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <200906220117.n5M1HTVJ004183@e2.ny.us.ibm.com>
2009-06-23 14:49 ` [LTP] [PATCH] Fix cleanup procedure in the setuid04 test Subrata Modak
2009-06-23 15:41   ` Jiří Paleček
2009-06-23 20:48     ` Jiří Paleček
2009-06-25  9:10       ` Subrata Modak
2009-05-12 17:06 Jiri Palecek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox