about summary refs log tree commit diff
path: root/posix/tst-exec.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-10-26 08:11:19 +0000
committerUlrich Drepper <drepper@redhat.com>2000-10-26 08:11:19 +0000
commit726b7b0f5cce9df5dd406a6a38a3e104fac9a070 (patch)
tree51be27a039af937051a2ee45d7765c024b6c83c8 /posix/tst-exec.c
parent1267f93e167d951907e335bed5cbf1fa56f7357b (diff)
downloadglibc-726b7b0f5cce9df5dd406a6a38a3e104fac9a070.tar.gz
glibc-726b7b0f5cce9df5dd406a6a38a3e104fac9a070.tar.xz
glibc-726b7b0f5cce9df5dd406a6a38a3e104fac9a070.zip
Update.
2000-10-26  Ulrich Drepper  <drepper@redhat.com>

	* posix/Makefile (tests): Add tst-chmod.
	(tst-chmod-ARGS): Define.
	* posix/tst-chmod.c: New file.

	* test-skeleton.c: Before calling user-defined function remove
	parameters from argument list.
	* posix/tst-exec.c: Adjust to this change.
	* posix/tst-spawn.c: Likewise.

	* sysdeps/unix/opendir.c (__opendir): Optimize a bit.  Add
	__builtin_expect.
Diffstat (limited to 'posix/tst-exec.c')
-rw-r--r--posix/tst-exec.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/posix/tst-exec.c b/posix/tst-exec.c
index 0cb988d1de..2c541fcd04 100644
--- a/posix/tst-exec.c
+++ b/posix/tst-exec.c
@@ -126,24 +126,27 @@ do_test (int argc, char *argv[])
   int status;
 
   /* We must have
-     - five parameters left of called initially
-       + --
+     - four parameters left of called initially
        + path for ld.so
        + "--library-path"
        + the library path
        + the application name
-     - five parameters left if called through re-execution
-       + --direct
-       + --restart
+     - three parameters left if called through re-execution
        + file descriptor number which is supposed to be closed
        + the open file descriptor
        + the name of the closed desriptor
   */
-  if (argc != 6)
-    error (EXIT_FAILURE, 0, "wrong number of arguments (%d)", argc);
 
   if (restart)
-    return handle_restart (argv[3], argv[4], argv[5]);
+    {
+      if (argc != 4)
+	error (EXIT_FAILURE, 0, "wrong number of arguments (%d)", argc);
+
+      return handle_restart (argv[1], argv[2], argv[3]);
+    }
+
+  if (argc != 5)
+    error (EXIT_FAILURE, 0, "wrong number of arguments (%d)", argc);
 
   /* Prepare the test.  We are creating two files: one which file descriptor
      will be marked with FD_CLOEXEC, another which is not.  */
@@ -182,7 +185,7 @@ do_test (int argc, char *argv[])
       snprintf (fd2name, sizeof fd2name, "%d", fd2);
 
       /* This is the child.  Construct the command line.  */
-      execl (argv[2], argv[2], argv[3], argv[4], argv[5], "--direct",
+      execl (argv[1], argv[1], argv[2], argv[3], argv[4], "--direct",
 	     "--restart", fd1name, fd2name, name1, NULL);
 
       error (EXIT_FAILURE, errno, "cannot exec");