From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NO_DNS_FOR_FROM,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from integral2.. (unknown [36.81.65.188]) by gnuweeb.org (Postfix) with ESMTPSA id A32C2801D5; Sun, 3 Jul 2022 06:44:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1656830681; bh=n0MhH4UJwahD5/LSJRmoCIUvNRpxnmSnrXpfUHPvIiw=; h=From:To:Cc:Subject:Date:From; b=npp8mskjLvriH4eh1RXljkzT8cPWEsWHDfm0KPVzr70mLqtBf5x3wgzJBcHhMtpOF dgHddTgCuBhXIEhHFBs5dEg6pV8S4rm9coQPZ68712dKloG+7cSNIx5n1hRT9HapmP kefqPLB1uDntmTnU8EyXMbJPwqnDom98+Sdtg0fOahNNwrgpNLyZmhXey3J9Q1gSKQ gBWtU2qAhRWGCaSxxE4i9aX9Qs4KnEc83HGDBWc2bQ4NtyppoIktdS068+7qF/rWQ8 k1NCqzNj3goTjn15Qmghf1J/B/DASUjx9CWlKJehdzQwTcEDXculzqsbIbxalj0J73 e0V3nzkdwRZ7A== From: Ammar Faizi To: Jens Axboe Cc: Ammar Faizi , Dylan Yudaken , Facebook Kernel Team , GNU/Weeb Mailing List , io-uring Mailing List Subject: [PATCH liburing] test/helpers: Use a proper cast for `(struct sockaddr *)` argument Date: Sun, 3 Jul 2022 13:44:05 +0700 Message-Id: <20220703063755.189175-1-ammar.faizi@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2031; i=ammarfaizi2@gnuweeb.org; h=from:subject; bh=KemLh7csRivuskefKnyeOdJ1j70scQpC1JqFAAJzVSo=; b=owEBbQGS/pANAwAKATZPujT/FwpLAcsmYgBiwTog8vL8JMtBUfR9HJpLp8fRqhdskg4/BZlFd56G CGIluw+JATMEAAEKAB0WIQTok3JtyOTA3juiAQc2T7o0/xcKSwUCYsE6IAAKCRA2T7o0/xcKS3FjCA C+LfLaEhkUp/iAFS3NhMVwEs3uvv2s1oDxJWnEG4O7fTdeKuqtKjb3fOuFBnXA7/neZ+VD1Vnk7P+d Xfk7ANSLMqlGKui95QBcnyecuc64hpBRnT8ikeoUdkF/yyhjFdW/oBEb+yZ800HKc/xD7x07zcDpgw v7yz2OksmCbSchnSGCwegvqwi5ykVY4K+J2hxWc3qblzLJDYml+4UqvpF5+k4xfMyuPZwtTvSh5iUq ut61XMPWStpmo2zfVJFrmJEaWiSG3eOZS265AttTZvM7yOGpgn2o6Gd3PmXarSushErGK+YOdOyqaA t+SvUS7GU32tBp9I+1iz2/brixRHDx X-Developer-Key: i=ammarfaizi2@gnuweeb.org; a=openpgp; fpr=E893726DC8E4C0DE3BA20107364FBA34FF170A4B Content-Transfer-Encoding: 8bit List-Id: From: Ammar Faizi Sometimes the compiler accepts (struct sockaddr_in *) to be passed in to (struct sockaddr *) without a cast. But not all compilers agree with that. Building with clang 13.0.1 yields the following error: error: incompatible pointer types passing 'struct sockaddr_in *' to \ parameter of type 'struct sockaddr *' [-Werror,-Wincompatible-pointer-types] Explicitly cast the pointer to (struct sockaddr *) to avoid this error. Cc: kernel-team@fb.com Cc: Dylan Yudaken Fixes: 9167905ca187064ba1d9ac4c8bb8484157bef86b ("add t_create_socket_pair") Signed-off-by: Ammar Faizi --- test/helpers.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/helpers.c b/test/helpers.c index 3660cc0..0146533 100644 --- a/test/helpers.c +++ b/test/helpers.c @@ -190,26 +190,28 @@ int t_create_socket_pair(int fd[2], bool stream) goto errno_cleanup; } - if (getsockname(fd[0], &serv_addr, (socklen_t *)&paddrlen)) { + if (getsockname(fd[0], (struct sockaddr *)&serv_addr, + (socklen_t *)&paddrlen)) { fprintf(stderr, "getsockname failed\n"); goto errno_cleanup; } inet_pton(AF_INET, "127.0.0.1", &serv_addr.sin_addr); - if (connect(fd[1], &serv_addr, paddrlen)) { + if (connect(fd[1], (struct sockaddr *)&serv_addr, paddrlen)) { fprintf(stderr, "connect failed\n"); goto errno_cleanup; } if (!stream) { /* connect the other udp side */ - if (getsockname(fd[1], &serv_addr, (socklen_t *)&paddrlen)) { + if (getsockname(fd[1], (struct sockaddr *)&serv_addr, + (socklen_t *)&paddrlen)) { fprintf(stderr, "getsockname failed\n"); goto errno_cleanup; } inet_pton(AF_INET, "127.0.0.1", &serv_addr.sin_addr); - if (connect(fd[0], &serv_addr, paddrlen)) { + if (connect(fd[0], (struct sockaddr *)&serv_addr, paddrlen)) { fprintf(stderr, "connect failed\n"); goto errno_cleanup; } base-commit: 98c14a04e2c0dcdfbb71372a1a209ed889fb3e4d -- Ammar Faizi