From: Carmelo AMOROSO <carmelo.amoroso@st.com>
To: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] syscalls: fix creat07 setup and argv to execve
Date: Wed, 25 Jan 2012 13:00:47 +0100 [thread overview]
Message-ID: <4F1FEEEF.2080506@st.com> (raw)
In-Reply-To: <1327481724-28367-1-git-send-email-salvatore.cro@st.com>
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
next prev parent reply other threads:[~2012-01-25 12:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-25 8:55 [LTP] [PATCH] syscalls: fix creat07 setup and argv to execve Salvatore CRO'
2012-01-25 12:00 ` Carmelo AMOROSO [this message]
2012-01-25 12:27 ` Salvatore CRO'
2012-01-30 15:45 ` Carmelo AMOROSO
2012-02-01 11:56 ` Salvatore CRO'
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=4F1FEEEF.2080506@st.com \
--to=carmelo.amoroso@st.com \
--cc=ltp-list@lists.sourceforge.net \
/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