Fix typo in setup function as app[0] should be checked instead of test_app[0]. Fix test_path concatenating the absolute path to test_app when required (app[0] == '/'). Finally fix execve (returning Bad address - EFAULT) argument av[1] as it requires argument array to be terminated by a null pointer.
Signed-off-by: Salvatore Cro <[email protected]> --- testcases/kernel/syscalls/creat/creat07.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/testcases/kernel/syscalls/creat/creat07.c b/testcases/kernel/syscalls/creat/creat07.c index 4ed2c22..3bb1288 100644 --- a/testcases/kernel/syscalls/creat/creat07.c +++ b/testcases/kernel/syscalls/creat/creat07.c @@ -90,8 +90,9 @@ int main(int ac, char **av) tst_brkm(TBROK|TERRNO, cleanup, "fork #1 failed"); if (pid == 0) { - char *av[1]; + char *av[2]; av[0] = basename(test_app); + av[1] = NULL; (void)execve(test_app, av, NULL); perror("execve failed"); exit(1); @@ -138,8 +139,9 @@ 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"); -- 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 [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
