aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2022-09-28 14:33:21 +1000
committerStefano Brivio <sbrivio@redhat.com>2022-09-29 12:22:07 +0200
commita668d87e7e1f0eae424212bfde31d7bbf464f8b1 (patch)
tree6bf49081f9afe39153f162f57fb211621453be37
parentab96da98cd6ccabf184c12575ab5116de51c75c3 (diff)
downloadpasst-a668d87e7e1f0eae424212bfde31d7bbf464f8b1.tar
passt-a668d87e7e1f0eae424212bfde31d7bbf464f8b1.tar.gz
passt-a668d87e7e1f0eae424212bfde31d7bbf464f8b1.tar.bz2
passt-a668d87e7e1f0eae424212bfde31d7bbf464f8b1.tar.lz
passt-a668d87e7e1f0eae424212bfde31d7bbf464f8b1.tar.xz
passt-a668d87e7e1f0eae424212bfde31d7bbf464f8b1.tar.zst
passt-a668d87e7e1f0eae424212bfde31d7bbf464f8b1.zip
Don't shadow global function names
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 <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--qrap.c10
1 files 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;