Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: gdb-patches@sourceware.org
Subject: [PATCH v2] sim: use socklen_t with accept()
Date: Tue, 30 Mar 2010 22:08:00 -0000	[thread overview]
Message-ID: <1269986875-1519-1-git-send-email-vapier@gentoo.org> (raw)
In-Reply-To: <m2y6h9tzwl.fsf@igel.home>

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 <vapier@gentoo.org>
---
v2
	- pull in socklen_t configure checks as suggested by people

2010-03-30  Mike Frysinger  <vapier@gentoo.org>

	* 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 <sys/stat.h>
 #endif]])
+AC_CHECK_TYPES(socklen_t, [], [],
+[#include <sys/types.h>
+#include <sys/socket.h>
+])
+
 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


  reply	other threads:[~2010-03-30 22:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-29 19:38 [PATCH] " Mike Frysinger
2010-03-30 16:11 ` Tom Tromey
2010-03-30 18:42   ` Andreas Schwab
2010-03-30 22:08     ` Mike Frysinger [this message]
2010-03-30 22:22       ` [PATCH v2] " Tom Tromey
2010-03-30 22:39         ` [PATCH v3] " Mike Frysinger
2010-03-30 23:04           ` Tom Tromey
2010-03-30 22:39         ` [PATCH v2] " Mike Frysinger
2010-03-30 23:03           ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1269986875-1519-1-git-send-email-vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox