This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/3] Support run tst-exec and tst-spawn directly


>    /* 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]