This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 1/3] Support run tst-exec and tst-spawn directly
- From: Roland McGrath <roland at hack dot frob dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Thu, 10 Jan 2013 11:47:57 -0800 (PST)
- Subject: Re: [PATCH 1/3] Support run tst-exec and tst-spawn directly
- References: <20121221005200.GA25282@intel.com>
> /* We must have
> - - four parameters left of called initially
> - + path for ld.so
> - + "--library-path"
> - + the library path
> + - one or four parameters left of called initially
> + + path for ld.so optional
> + + "--library-path" optional
> + + the library path optional
Fix the typo while you're here: s/of/if/.
(Same in both files.)
> @@ -235,18 +235,33 @@ do_test (int argc, char *argv[])
> snprintf (fd3name, sizeof fd3name, "%d", fd3);
> snprintf (fd4name, sizeof fd4name, "%d", fd4);
>
> - spargv[0] = argv[1];
> - spargv[1] = argv[2];
> - spargv[2] = argv[3];
> - spargv[3] = argv[4];
> - spargv[4] = (char *) "--direct";
> - spargv[5] = (char *) "--restart";
> - spargv[6] = fd1name;
> - spargv[7] = fd2name;
> - spargv[8] = fd3name;
> - spargv[9] = fd4name;
> - spargv[10] = name1;
> - spargv[11] = NULL;
> + if (argc == (restart ? 6 : 5))
> + {
> + spargv[0] = argv[1];
> + spargv[1] = argv[2];
> + spargv[2] = argv[3];
> + spargv[3] = argv[4];
> + spargv[4] = (char *) "--direct";
> + spargv[5] = (char *) "--restart";
> + spargv[6] = fd1name;
> + spargv[7] = fd2name;
> + spargv[8] = fd3name;
> + spargv[9] = fd4name;
> + spargv[10] = name1;
> + spargv[11] = NULL;
> + }
> + else
> + {
> + spargv[0] = argv[1];
> + spargv[1] = (char *) "--direct";
> + spargv[2] = (char *) "--restart";
> + spargv[3] = fd1name;
> + spargv[4] = fd2name;
> + spargv[5] = fd3name;
> + spargv[6] = fd4name;
> + spargv[7] = name1;
> + spargv[8] = NULL;
> + }
Use an index variable to make this not be repetitive.
Thanks,
Roland