From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Gibson To: passt-dev@passt.top Subject: [PATCH v2 10/28] Don't shadow global function names Date: Thu, 29 Sep 2022 13:38:14 +1000 Message-ID: <20220929033832.923149-11-david@gibson.dropbear.id.au> In-Reply-To: <20220929033832.923149-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6006869125698618818==" --===============6006869125698618818== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit cppcheck points out that qrap's main shadows the global err() function with a local. Rename it to rc to avoid the clash. Signed-off-by: David Gibson --- qrap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/qrap.c b/qrap.c index da96b22..a7d0645 100644 --- a/qrap.c +++ b/qrap.c @@ -115,7 +115,7 @@ void usage(const char *name) */ int main(int argc, char **argv) { - int i, s, qemu_argc = 0, addr_map = 0, has_dev = 0, retry_on_reset, err; + int i, s, qemu_argc = 0, addr_map = 0, has_dev = 0, retry_on_reset, rc; struct timeval tv = { .tv_sec = 0, .tv_usec = (long)(500 * 1000) }; char *qemu_argv[ARG_MAX], dev_str[ARG_MAX]; struct sockaddr_un addr = { @@ -281,13 +281,13 @@ retry: errno = 0; if (connect(s, (const struct sockaddr *)&addr, sizeof(addr))) { - err = errno; + rc = errno; perror("connect"); } else if (send(s, &probe, sizeof(probe), 0) != sizeof(probe)) { - err = errno; + rc = errno; perror("send"); } else if (recv(s, &probe_r, 1, MSG_PEEK) <= 0) { - err = errno; + rc = errno; perror("recv"); } else { break; @@ -315,7 +315,7 @@ retry: * this FIXME will probably remain until the tool itself is * obsoleted. */ - if (retry_on_reset && err == ECONNRESET) { + if (retry_on_reset && rc == ECONNRESET) { retry_on_reset--; usleep(50 * 1000); goto retry; -- 2.37.3 --===============6006869125698618818==--