diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2013-01-10 14:14:55 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2013-01-10 14:14:55 -0800 |
commit | 4cf8f2098f227d32f3b73c70a6498c84872c24ba (patch) | |
tree | 44521528be24870c4fe10f353172a6faf0e24329 /posix/tst-exec.c | |
parent | 828beb132ddf5664cf9971329e8cdcb93dce43af (diff) | |
download | glibc-4cf8f2098f227d32f3b73c70a6498c84872c24ba.tar.gz glibc-4cf8f2098f227d32f3b73c70a6498c84872c24ba.tar.xz glibc-4cf8f2098f227d32f3b73c70a6498c84872c24ba.zip |
Support run tst-exec and tst-spawn directly
Diffstat (limited to 'posix/tst-exec.c')
-rw-r--r-- | posix/tst-exec.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/posix/tst-exec.c b/posix/tst-exec.c index 3a76b3229f..a1a2c183c6 100644 --- a/posix/tst-exec.c +++ b/posix/tst-exec.c @@ -126,10 +126,10 @@ do_test (int argc, char *argv[]) int status; /* We must have - - four parameters left of called initially - + path for ld.so - + "--library-path" - + the library path + - one or four parameters left if called initially + + path for ld.so optional + + "--library-path" optional + + the library path optional + the application name - three parameters left if called through re-execution + file descriptor number which is supposed to be closed @@ -145,7 +145,7 @@ do_test (int argc, char *argv[]) return handle_restart (argv[1], argv[2], argv[3]); } - if (argc != 5) + if (argc != 2 && argc != 5) error (EXIT_FAILURE, 0, "wrong number of arguments (%d)", argc); /* Prepare the test. We are creating two files: one which file descriptor @@ -185,8 +185,12 @@ do_test (int argc, char *argv[]) snprintf (fd2name, sizeof fd2name, "%d", fd2); /* This is the child. Construct the command line. */ - execl (argv[1], argv[1], argv[2], argv[3], argv[4], "--direct", - "--restart", fd1name, fd2name, name1, NULL); + if (argc == 5) + execl (argv[1], argv[1], argv[2], argv[3], argv[4], "--direct", + "--restart", fd1name, fd2name, name1, NULL); + else + execl (argv[1], argv[1], "--direct", + "--restart", fd1name, fd2name, name1, NULL); error (EXIT_FAILURE, errno, "cannot exec"); } |