From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1RsYnh-00068a-AD for ltp-list@lists.sourceforge.net; Wed, 01 Feb 2012 11:56:33 +0000 Received: from eu1sys200aog104.obsmtp.com ([207.126.144.117]) by sog-mx-2.v43.ch3.sourceforge.com with smtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1RsYnb-0000T1-Ku for ltp-list@lists.sourceforge.net; Wed, 01 Feb 2012 11:56:33 +0000 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id BAB7F16D for ; Wed, 1 Feb 2012 11:56:20 +0000 (GMT) Received: from mail7.sgp.st.com (mail7.sgp.st.com [164.129.223.81]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 8A5F5240E for ; Wed, 1 Feb 2012 11:56:20 +0000 (GMT) Message-ID: <4F292862.8030503@st.com> Date: Wed, 01 Feb 2012 12:56:18 +0100 From: "Salvatore CRO'" MIME-Version: 1.0 References: <1327481724-28367-1-git-send-email-salvatore.cro@st.com> <4F1FEEEF.2080506@st.com> <4F1FF526.7030701@st.com> <4F26BB2C.9040307@st.com> In-Reply-To: <4F26BB2C.9040307@st.com> Subject: Re: [LTP] [PATCH] syscalls: fix creat07 setup and argv to execve List-Id: Linux Test Project General Discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ltp-list-bounces@lists.sourceforge.net To: ltp-list@lists.sourceforge.net 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 >>>> --- >>>> 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) 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