tests: avoid -Wshadow warning

Seen on GCC 14.2.0:

tests/xargs/test-sigusr.c: In function 'run_xargs':
tests/xargs/test-sigusr.c:159:43: warning: declaration of 'optarg' \
  shadows a global declaration [-Wshadow]
  159 | run_xargs(const char *option, const char *optarg, int send_signal)
      |                               ~~~~~~~~~~~~^~~~~~
  ...
  /usr/include/bits/getopt_core.h:36:14: note: shadowed declaration is here
   36 | extern char *optarg;
      |              ^~~~~~

* tests/xargs/test-sigusr.c (run_xargs): Rename 'optarg' parameter
to 'opt_arg'.
This commit is contained in:
Bernhard Voelker 2024-09-17 22:46:58 +02:00
parent 523043b313
commit e38e2f8a36

View File

@ -156,7 +156,7 @@ struct status
/* Run xargs and return its exit status */
static struct status
run_xargs(const char *option, const char *optarg, int send_signal)
run_xargs(const char *option, const char *opt_arg, int send_signal)
{
int i = 0;
enum { ARGV_MAX = 9 };
@ -172,9 +172,9 @@ run_xargs(const char *option, const char *optarg, int send_signal)
{
argv[i++] = (char*)option;
}
if (optarg)
if (opt_arg)
{
argv[i++] = (char*)optarg;
argv[i++] = (char*)opt_arg;
}
argv[i++] = (char*)"sh";
argv[i++] = (char*)"-c";