Commit 3ec62f54 by Daniel van Gerpen Committed by Jeff Law

argv.c (expandargv): Correct check for dynamically allocated argv.

2018-01-10  Daniel van Gerpen  <daniel@vangerpen.de>

	* argv.c (expandargv): Correct check for dynamically
	allocated argv.

From-SVN: r256460
parent 83cbbe3a
2018-01-10 Daniel van Gerpen <daniel@vangerpen.de>
* argv.c (expandargv): Correct check for dynamically
allocated argv.
2018-01-03 Jakub Jelinek <jakub@redhat.com> 2018-01-03 Jakub Jelinek <jakub@redhat.com>
Update copyright years. Update copyright years.
......
...@@ -367,8 +367,8 @@ expandargv (int *argcp, char ***argvp) ...@@ -367,8 +367,8 @@ expandargv (int *argcp, char ***argvp)
{ {
/* The argument we are currently processing. */ /* The argument we are currently processing. */
int i = 0; int i = 0;
/* Non-zero if ***argvp has been dynamically allocated. */ /* To check if ***argvp has been dynamically allocated. */
int argv_dynamic = 0; char ** const original_argv = *argvp;
/* Limit the number of response files that we parse in order /* Limit the number of response files that we parse in order
to prevent infinite recursion. */ to prevent infinite recursion. */
unsigned int iteration_limit = 2000; unsigned int iteration_limit = 2000;
...@@ -449,7 +449,7 @@ expandargv (int *argcp, char ***argvp) ...@@ -449,7 +449,7 @@ expandargv (int *argcp, char ***argvp)
/* Parse the string. */ /* Parse the string. */
file_argv = buildargv (buffer); file_argv = buildargv (buffer);
/* If *ARGVP is not already dynamically allocated, copy it. */ /* If *ARGVP is not already dynamically allocated, copy it. */
if (!argv_dynamic) if (*argvp == original_argv)
*argvp = dupargv (*argvp); *argvp = dupargv (*argvp);
/* Count the number of arguments. */ /* Count the number of arguments. */
file_argc = 0; file_argc = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment