summaryrefslogtreecommitdiff
path: root/tools/dbus-print-message.c
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2016-02-10 13:11:28 +0000
committerRalf Habacker <ralf.habacker@freenet.de>2016-02-11 02:04:53 +0100
commit15868d2a3957f4e5056544844f29629fae674b61 (patch)
treeb94cca0e0873bd103e8323025eeea913df97b8b3 /tools/dbus-print-message.c
parent93895bc3a51db6fee9e4eed872f18f9b912bacba (diff)
downloaddbus-15868d2a3957f4e5056544844f29629fae674b61.tar.gz
Consistently use socklen_t for getsockname, getsockopt etc.
This fixes signedness mismatch warnings on platforms where socklen_t is unsigned, notably Linux (where it's an unsigned int). We still use int for the fallback case where the platform does not define socklen_t, because that was the traditional (pre-POSIX) type: for details see NOTES in Linux accept(2), <http://manpages.debian.org/cgi-bin/man.cgi?query=accept&sektion=2>. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93069 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Diffstat (limited to 'tools/dbus-print-message.c')
-rw-r--r--tools/dbus-print-message.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/dbus-print-message.c b/tools/dbus-print-message.c
index b747e877..547f72f8 100644
--- a/tools/dbus-print-message.c
+++ b/tools/dbus-print-message.c
@@ -52,6 +52,10 @@
#endif
#endif
+#ifndef HAVE_SOCKLEN_T
+#define socklen_t int
+#endif
+
static const char*
type_to_name (int message_type)
{
@@ -182,8 +186,8 @@ print_fd (int fd, int depth)
struct sockaddr_in6 ipv6;
} addr, peer;
char hostip[INET6_ADDRSTRLEN];
- int addrlen = sizeof (addr);
- int peerlen = sizeof (peer);
+ socklen_t addrlen = sizeof (addr);
+ socklen_t peerlen = sizeof (peer);
int has_peer;
/* Don't print the fd number: it is different in every process and since