public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [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

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