[PATCH 11/23] examples/multi_process: fix shadowed variable
Stephen Hemminger
stephen at networkplumber.org
Tue Apr 7 05:49:37 CEST 2026
The string passed to parsing function number of clients
shadowed global declaration. Also avoid similar problem in
parsing portmask.
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
.../multi_process/client_server_mp/mp_server/args.c | 12 ++++++------
.../client_server_mp/mp_server/meson.build | 1 -
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/examples/multi_process/client_server_mp/mp_server/args.c b/examples/multi_process/client_server_mp/mp_server/args.c
index 3c2ca266b0..60dbb3c626 100644
--- a/examples/multi_process/client_server_mp/mp_server/args.c
+++ b/examples/multi_process/client_server_mp/mp_server/args.c
@@ -42,18 +42,18 @@ usage(void)
* array variable
*/
static int
-parse_portmask(const char *portmask)
+parse_portmask(const char *str)
{
char *end = NULL;
unsigned long long pm;
uint16_t id;
- if (portmask == NULL || *portmask == '\0')
+ if (str == NULL || *str == '\0')
return -1;
/* convert parameter to a number and verify */
errno = 0;
- pm = strtoull(portmask, &end, 16);
+ pm = strtoull(str, &end, 16);
if (errno != 0 || end == NULL || *end != '\0')
return -1;
@@ -80,15 +80,15 @@ parse_portmask(const char *portmask)
* and convert to a number to store in the num_clients variable
*/
static int
-parse_num_clients(const char *clients)
+parse_num_clients(const char *str)
{
char *end = NULL;
unsigned long temp;
- if (clients == NULL || *clients == '\0')
+ if (str == NULL || *str == '\0')
return -1;
- temp = strtoul(clients, &end, 10);
+ temp = strtoul(str, &end, 10);
if (end == NULL || *end != '\0' || temp == 0)
return -1;
diff --git a/examples/multi_process/client_server_mp/mp_server/meson.build b/examples/multi_process/client_server_mp/mp_server/meson.build
index a31eea764e..9e585e80b9 100644
--- a/examples/multi_process/client_server_mp/mp_server/meson.build
+++ b/examples/multi_process/client_server_mp/mp_server/meson.build
@@ -14,4 +14,3 @@ sources = files(
'init.c',
'main.c',
)
-cflags += no_shadow_cflag
--
2.53.0
More information about the dev
mailing list