summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-06-11 14:41:14 +0000
committerStefan Metzmacher <metze@samba.org>2008-06-10 11:36:39 +0200
commit9b7b444e35493100df2258dc78db59f0f6237d0d (patch)
treeb7f043a72a34948f2a3617a8638c9d15b8206ad5
parentc8eccf53810bef0d5b5245a3b8538cfb0e6879fb (diff)
downloadsamba-9b7b444e35493100df2258dc78db59f0f6237d0d.tar.gz
samba-9b7b444e35493100df2258dc78db59f0f6237d0d.tar.bz2
samba-9b7b444e35493100df2258dc78db59f0f6237d0d.zip
r23420: try to make the IBM checker happy
metze (cherry picked from commit 96f1a0dfaa18a432fca4b5432d929d8daed0abb1) (This used to be commit 801ed0b79956133f2baa6b2db4a7dd5a68060edc)
-rw-r--r--source3/lib/socket_wrapper/socket_wrapper.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/source3/lib/socket_wrapper/socket_wrapper.c b/source3/lib/socket_wrapper/socket_wrapper.c
index f0fa85a8be..2ad6a2e9e5 100644
--- a/source3/lib/socket_wrapper/socket_wrapper.c
+++ b/source3/lib/socket_wrapper/socket_wrapper.c
@@ -175,7 +175,7 @@ static void set_port(int family, int prt, struct sockaddr *addr)
}
}
-static int socket_length(int family)
+static size_t socket_length(int family)
{
switch (family) {
case AF_INET:
@@ -185,7 +185,7 @@ static int socket_length(int family)
return sizeof(struct sockaddr_in6);
#endif
}
- return -1;
+ return 0;
}
@@ -789,6 +789,9 @@ static struct swrap_packet *swrap_packet_init(struct timeval *tval,
wire_hdr_len = sizeof(packet->ip.hdr) + sizeof(packet->ip.p.udp);
wire_len = wire_hdr_len + payload_len;
break;
+
+ default:
+ return NULL;
}
if (unreachable) {
@@ -1232,10 +1235,12 @@ _PUBLIC_ int swrap_socket(int family, int type, int protocol)
if (type == SOCK_STREAM) {
break;
}
+ /*fall through*/
case 17:
if (type == SOCK_DGRAM) {
break;
}
+ /*fall through*/
default:
errno = EPROTONOSUPPORT;
return -1;
@@ -1279,7 +1284,7 @@ _PUBLIC_ int swrap_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
* socket family
*/
my_addrlen = socket_length(parent_si->family);
- if (my_addrlen < 0) {
+ if (my_addrlen <= 0) {
errno = EINVAL;
return -1;
}