From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31339 invoked by alias); 30 Mar 2010 22:08:14 -0000 Received: (qmail 31324 invoked by uid 22791); 30 Mar 2010 22:08:12 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp.gentoo.org (HELO smtp.gentoo.org) (140.211.166.183) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 30 Mar 2010 22:08:07 +0000 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id B0ED267F32 for ; Tue, 30 Mar 2010 22:08:05 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH v2] sim: use socklen_t with accept() Date: Tue, 30 Mar 2010 22:08:00 -0000 Message-Id: <1269986875-1519-1-git-send-email-vapier@gentoo.org> In-Reply-To: References: X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-03/txt/msg01086.txt.bz2 The accept() function takes a socklen_t, not an int. Using an int causes: dv-sockser.c: In function 'connected_p': dv-sockser.c:273: warning: pointer targets in passing argument 3 of 'accept' differ in signedness So use the same socklen_t detection code as gdb and convert the accept(). Signed-off-by: Mike Frysinger --- v2 - pull in socklen_t configure checks as suggested by people 2010-03-30 Mike Frysinger * configure.ac: Check for socklen_t. * configure, config.in: Regenerated. * dv-sockser.c (connected_p): Change addrlen type to socklen_t. Note: this config.in diffstat is larger because the regen tweaked the comment style for a lot of defines ... not sure if this is correct sim/common/config.in | 29 +++++++++++--------- sim/common/configure | 68 +++++++++++++++++++++++++++++++++++++++++++++++ sim/common/configure.ac | 5 +++ sim/common/dv-sockser.c | 2 +- 4 files changed, 90 insertions(+), 14 deletions(-) diff --git a/sim/common/configure.ac b/sim/common/configure.ac index 5f5845a..39302c8 100644 --- a/sim/common/configure.ac +++ b/sim/common/configure.ac @@ -49,5 +49,10 @@ AC_CHECK_MEMBERS([[struct stat.st_dev], [struct stat.st_ino], #ifdef HAVE_SYS_STAT_H #include #endif]]) +AC_CHECK_TYPES(socklen_t, [], [], +[#include +#include +]) + AC_OUTPUT(Makefile, [case x$CONFIG_HEADERS in xcconfig.h:config.in) echo > stamp-h ;; esac]) diff --git a/sim/common/dv-sockser.c b/sim/common/dv-sockser.c index 9195190..c584fc7 100644 --- a/sim/common/dv-sockser.c +++ b/sim/common/dv-sockser.c @@ -243,7 +243,7 @@ connected_p (SIM_DESC sd) struct timeval tv; fd_set readfds; struct sockaddr sockaddr; - int addrlen; + socklen_t addrlen; if (sockser_listen_fd == -1) return 0; -- 1.7.0.2