* [LTP] [PATCH] syscalls: fix creat07 setup and argv to execve
@ 2012-01-25 8:55 Salvatore CRO'
2012-01-25 12:00 ` Carmelo AMOROSO
0 siblings, 1 reply; 5+ messages in thread
From: Salvatore CRO' @ 2012-01-25 8:55 UTC (permalink / raw)
To: ltp-list
Fix test_path variable logic in setup function.
Also use a new argv variable to be passed to execve.
Signed-off-by: Salvatore Cro <salvatore.cro@st.com>
---
testcases/kernel/syscalls/creat/creat07.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/testcases/kernel/syscalls/creat/creat07.c b/testcases/kernel/syscalls/creat/creat07.c
index 4ed2c22..43a6030 100644
--- a/testcases/kernel/syscalls/creat/creat07.c
+++ b/testcases/kernel/syscalls/creat/creat07.c
@@ -90,9 +90,8 @@ int main(int ac, char **av)
tst_brkm(TBROK|TERRNO, cleanup, "fork #1 failed");
if (pid == 0) {
- char *av[1];
- av[0] = basename(test_app);
- (void)execve(test_app, av, NULL);
+ char *argv[] = { test_app, NULL };
+ (void)execve(test_app, argv, NULL);
perror("execve failed");
exit(1);
}
@@ -138,14 +137,15 @@ void setup(char *app)
char *cmd, *pwd = NULL;
char test_path[MAXPATHLEN];
- if (test_app[0] == '/')
- strncpy(test_path, test_app, sizeof(test_app));
+ if (app[0] == '/')
+ snprintf(test_path, sizeof(test_path), "%s/%s",
+ dirname(app), test_app);
else {
if ((pwd = get_current_dir_name()) == NULL)
tst_brkm(TBROK|TERRNO, NULL, "getcwd failed");
snprintf(test_path, sizeof(test_path), "%s/%s",
- pwd, basename(test_app));
+ pwd, test_app);
free(pwd);
}
--
1.7.4.4
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
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] syscalls: fix creat07 setup and argv to execve
2012-01-25 8:55 [LTP] [PATCH] syscalls: fix creat07 setup and argv to execve Salvatore CRO'
@ 2012-01-25 12:00 ` Carmelo AMOROSO
2012-01-25 12:27 ` Salvatore CRO'
0 siblings, 1 reply; 5+ messages in thread
From: Carmelo AMOROSO @ 2012-01-25 12:00 UTC (permalink / raw)
To: ltp-list
On 25/01/2012 9.55, Salvatore CRO' wrote:
> Fix test_path variable logic in setup function.
> Also use a new argv variable to be passed to execve.
>
> Signed-off-by: Salvatore Cro <salvatore.cro@st.com>
> ---
> testcases/kernel/syscalls/creat/creat07.c | 12 ++++++------
> 1 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/creat/creat07.c b/testcases/kernel/syscalls/creat/creat07.c
> index 4ed2c22..43a6030 100644
> --- a/testcases/kernel/syscalls/creat/creat07.c
> +++ b/testcases/kernel/syscalls/creat/creat07.c
> @@ -90,9 +90,8 @@ int main(int ac, char **av)
> tst_brkm(TBROK|TERRNO, cleanup, "fork #1 failed");
>
> if (pid == 0) {
> - char *av[1];
> - av[0] = basename(test_app);
> - (void)execve(test_app, av, NULL);
> + char *argv[] = { test_app, NULL };
> + (void)execve(test_app, argv, NULL);
> perror("execve failed");
> exit(1);
> }
> @@ -138,14 +137,15 @@ void setup(char *app)
> char *cmd, *pwd = NULL;
> char test_path[MAXPATHLEN];
>
> - if (test_app[0] == '/')
> - strncpy(test_path, test_app, sizeof(test_app));
> + if (app[0] == '/')
> + snprintf(test_path, sizeof(test_path), "%s/%s",
> + dirname(app), test_app);
> else {
> if ((pwd = get_current_dir_name()) == NULL)
> tst_brkm(TBROK|TERRNO, NULL, "getcwd failed");
>
> snprintf(test_path, sizeof(test_path), "%s/%s",
> - pwd, basename(test_app));
> + pwd, test_app);
>
> free(pwd);
> }
Hi Salvo,
could you clarify why this change is needed ?
cheers
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
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] syscalls: fix creat07 setup and argv to execve
2012-01-25 12:00 ` Carmelo AMOROSO
@ 2012-01-25 12:27 ` Salvatore CRO'
2012-01-30 15:45 ` Carmelo AMOROSO
0 siblings, 1 reply; 5+ messages in thread
From: Salvatore CRO' @ 2012-01-25 12:27 UTC (permalink / raw)
To: ltp-list
On 1/25/2012 1:00 PM, Carmelo AMOROSO wrote:
> On 25/01/2012 9.55, Salvatore CRO' wrote:
>> Fix test_path variable logic in setup function.
>> Also use a new argv variable to be passed to execve.
>>
>> Signed-off-by: Salvatore Cro<salvatore.cro@st.com>
>> ---
>> testcases/kernel/syscalls/creat/creat07.c | 12 ++++++------
>> 1 files changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/testcases/kernel/syscalls/creat/creat07.c b/testcases/kernel/syscalls/creat/creat07.c
>> index 4ed2c22..43a6030 100644
>> --- a/testcases/kernel/syscalls/creat/creat07.c
>> +++ b/testcases/kernel/syscalls/creat/creat07.c
>> @@ -90,9 +90,8 @@ int main(int ac, char **av)
>> tst_brkm(TBROK|TERRNO, cleanup, "fork #1 failed");
>>
>> if (pid == 0) {
>> - char *av[1];
>> - av[0] = basename(test_app);
>> - (void)execve(test_app, av, NULL);
>> + char *argv[] = { test_app, NULL };
>> + (void)execve(test_app, argv, NULL);
>> perror("execve failed");
>> exit(1);
>> }
>> @@ -138,14 +137,15 @@ void setup(char *app)
>> char *cmd, *pwd = NULL;
>> char test_path[MAXPATHLEN];
>>
>> - if (test_app[0] == '/')
>> - strncpy(test_path, test_app, sizeof(test_app));
>> + if (app[0] == '/')
>> + snprintf(test_path, sizeof(test_path), "%s/%s",
>> + dirname(app), test_app);
>> else {
>> if ((pwd = get_current_dir_name()) == NULL)
>> tst_brkm(TBROK|TERRNO, NULL, "getcwd failed");
>>
>> snprintf(test_path, sizeof(test_path), "%s/%s",
>> - pwd, basename(test_app));
>> + pwd, test_app);
>>
>> free(pwd);
>> }
> Hi Salvo,
> could you clarify why this change is needed ?
test_app is defined as follows :
#define test_app "test1"
so
if (test_app[0] == '/')
was a typo and segfaulting in uClibc.
The test (app) could have been invoked either from 1) <test path> or 2)
from another path :
- 1) test_path for test_app is pwd/test_app (not pwd/basename(test_path))
- 2) test_path is dirname(app)/test_app (not test_app)
Furthermore change related to argv variable is mostly a tidy-up plus
again drop of
basename(test_app).
Hope it's clear enough ;-)
> cheers
>
> ------------------------------------------------------------------------------
> Keep Your Developer Skills Current with LearnDevNow!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-d2d
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
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] syscalls: fix creat07 setup and argv to execve
2012-01-25 12:27 ` Salvatore CRO'
@ 2012-01-30 15:45 ` Carmelo AMOROSO
2012-02-01 11:56 ` Salvatore CRO'
0 siblings, 1 reply; 5+ messages in thread
From: Carmelo AMOROSO @ 2012-01-30 15:45 UTC (permalink / raw)
To: ltp-list
On 25/01/2012 13.27, Salvatore CRO' wrote:
> On 1/25/2012 1:00 PM, Carmelo AMOROSO wrote:
>> On 25/01/2012 9.55, Salvatore CRO' wrote:
>>> Fix test_path variable logic in setup function.
>>> Also use a new argv variable to be passed to execve.
>>>
>>> Signed-off-by: Salvatore Cro<salvatore.cro@st.com>
>>> ---
>>> testcases/kernel/syscalls/creat/creat07.c | 12 ++++++------
>>> 1 files changed, 6 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/testcases/kernel/syscalls/creat/creat07.c b/testcases/kernel/syscalls/creat/creat07.c
>>> index 4ed2c22..43a6030 100644
>>> --- a/testcases/kernel/syscalls/creat/creat07.c
>>> +++ b/testcases/kernel/syscalls/creat/creat07.c
>>> @@ -90,9 +90,8 @@ int main(int ac, char **av)
>>> tst_brkm(TBROK|TERRNO, cleanup, "fork #1 failed");
>>>
>>> if (pid == 0) {
>>> - char *av[1];
>>> - av[0] = basename(test_app);
>>> - (void)execve(test_app, av, NULL);
>>> + char *argv[] = { test_app, NULL };
>>> + (void)execve(test_app, argv, NULL);
>>> perror("execve failed");
>>> exit(1);
>>> }
>>> @@ -138,14 +137,15 @@ void setup(char *app)
>>> char *cmd, *pwd = NULL;
>>> char test_path[MAXPATHLEN];
>>>
>>> - if (test_app[0] == '/')
>>> - strncpy(test_path, test_app, sizeof(test_app));
>>> + if (app[0] == '/')
>>> + snprintf(test_path, sizeof(test_path), "%s/%s",
>>> + dirname(app), test_app);
>>> else {
>>> if ((pwd = get_current_dir_name()) == NULL)
>>> tst_brkm(TBROK|TERRNO, NULL, "getcwd failed");
>>>
>>> snprintf(test_path, sizeof(test_path), "%s/%s",
>>> - pwd, basename(test_app));
>>> + pwd, test_app);
>>>
>>> free(pwd);
>>> }
>> Hi Salvo,
>> could you clarify why this change is needed ?
>
> test_app is defined as follows :
>
> #define test_app "test1"
>
> so
>
> if (test_app[0] == '/')
>
> was a typo and segfaulting in uClibc.
>
> The test (app) could have been invoked either from 1) <test path> or 2)
> from another path :
> - 1) test_path for test_app is pwd/test_app (not pwd/basename(test_path))
> - 2) test_path is dirname(app)/test_app (not test_app)
>
> Furthermore change related to argv variable is mostly a tidy-up plus
> again drop of
> basename(test_app).
>
> Hope it's clear enough ;-)
>
>
Hi Salvo,
could you re-elaborate the patch description, and post it again.
Great catch anyway !
Cheers,
Carmelo
>> cheers
>>
>> ------------------------------------------------------------------------------
>> Keep Your Developer Skills Current with LearnDevNow!
>> The most comprehensive online learning library for Microsoft developers
>> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
>> Metro Style Apps, more. Free future releases when you subscribe now!
>> http://p.sf.net/sfu/learndevnow-d2d
>> _______________________________________________
>> Ltp-list mailing list
>> Ltp-list@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/ltp-list
>
>
> ------------------------------------------------------------------------------
> Keep Your Developer Skills Current with LearnDevNow!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-d2d
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
>
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
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] syscalls: fix creat07 setup and argv to execve
2012-01-30 15:45 ` Carmelo AMOROSO
@ 2012-02-01 11:56 ` Salvatore CRO'
0 siblings, 0 replies; 5+ messages in thread
From: Salvatore CRO' @ 2012-02-01 11:56 UTC (permalink / raw)
To: ltp-list
On 1/30/2012 4:45 PM, Carmelo AMOROSO wrote:
> On 25/01/2012 13.27, Salvatore CRO' wrote:
>> On 1/25/2012 1:00 PM, Carmelo AMOROSO wrote:
>>> On 25/01/2012 9.55, Salvatore CRO' wrote:
>>>> Fix test_path variable logic in setup function.
>>>> Also use a new argv variable to be passed to execve.
>>>>
>>>> Signed-off-by: Salvatore Cro<salvatore.cro@st.com>
>>>> ---
>>>> testcases/kernel/syscalls/creat/creat07.c | 12 ++++++------
>>>> 1 files changed, 6 insertions(+), 6 deletions(-)
>>>>
>>>> diff --git a/testcases/kernel/syscalls/creat/creat07.c b/testcases/kernel/syscalls/creat/creat07.c
>>>> index 4ed2c22..43a6030 100644
>>>> --- a/testcases/kernel/syscalls/creat/creat07.c
>>>> +++ b/testcases/kernel/syscalls/creat/creat07.c
>>>> @@ -90,9 +90,8 @@ int main(int ac, char **av)
>>>> tst_brkm(TBROK|TERRNO, cleanup, "fork #1 failed");
>>>>
>>>> if (pid == 0) {
>>>> - char *av[1];
>>>> - av[0] = basename(test_app);
>>>> - (void)execve(test_app, av, NULL);
>>>> + char *argv[] = { test_app, NULL };
>>>> + (void)execve(test_app, argv, NULL);
>>>> perror("execve failed");
>>>> exit(1);
>>>> }
>>>> @@ -138,14 +137,15 @@ void setup(char *app)
>>>> char *cmd, *pwd = NULL;
>>>> char test_path[MAXPATHLEN];
>>>>
>>>> - if (test_app[0] == '/')
>>>> - strncpy(test_path, test_app, sizeof(test_app));
>>>> + if (app[0] == '/')
>>>> + snprintf(test_path, sizeof(test_path), "%s/%s",
>>>> + dirname(app), test_app);
>>>> else {
>>>> if ((pwd = get_current_dir_name()) == NULL)
>>>> tst_brkm(TBROK|TERRNO, NULL, "getcwd failed");
>>>>
>>>> snprintf(test_path, sizeof(test_path), "%s/%s",
>>>> - pwd, basename(test_app));
>>>> + pwd, test_app);
>>>>
>>>> free(pwd);
>>>> }
>>> Hi Salvo,
>>> could you clarify why this change is needed ?
>> test_app is defined as follows :
>>
>> #define test_app "test1"
>>
>> so
>>
>> if (test_app[0] == '/')
>>
>> was a typo and segfaulting in uClibc.
>>
>> The test (app) could have been invoked either from 1)<test path> or 2)
>> from another path :
>> - 1) test_path for test_app is pwd/test_app (not pwd/basename(test_path))
>> - 2) test_path is dirname(app)/test_app (not test_app)
>>
>> Furthermore change related to argv variable is mostly a tidy-up plus
>> again drop of
>> basename(test_app).
>>
>> Hope it's clear enough ;-)
>>
>>
> Hi Salvo,
> could you re-elaborate the patch description, and post it again.
> Great catch anyway !
Ok, I minimized changes (left basename as is), arranged description
and sent the (new) patch.
> Cheers,
> Carmelo
>
>>> cheers
>>>
>>> ------------------------------------------------------------------------------
>>> Keep Your Developer Skills Current with LearnDevNow!
>>> The most comprehensive online learning library for Microsoft developers
>>> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
>>> Metro Style Apps, more. Free future releases when you subscribe now!
>>> http://p.sf.net/sfu/learndevnow-d2d
>>> _______________________________________________
>>> Ltp-list mailing list
>>> Ltp-list@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/ltp-list
>>
>> ------------------------------------------------------------------------------
>> Keep Your Developer Skills Current with LearnDevNow!
>> The most comprehensive online learning library for Microsoft developers
>> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
>> Metro Style Apps, more. Free future releases when you subscribe now!
>> http://p.sf.net/sfu/learndevnow-d2d
>> _______________________________________________
>> Ltp-list mailing list
>> Ltp-list@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/ltp-list
>>
>
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
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:[~2012-02-01 11:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-25 8:55 [LTP] [PATCH] syscalls: fix creat07 setup and argv to execve Salvatore CRO'
2012-01-25 12:00 ` Carmelo AMOROSO
2012-01-25 12:27 ` Salvatore CRO'
2012-01-30 15:45 ` Carmelo AMOROSO
2012-02-01 11:56 ` Salvatore CRO'
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox