summaryrefslogtreecommitdiff
path: root/source4/lib/socket_wrapper/socket_wrapper.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-06-11 14:41:14 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:53:17 -0500
commitac00b6517e08977f44e7a3b106b97b899881d6aa (patch)
tree3d79e09622528dab102e0427a2ae1a04c5bf9fab /source4/lib/socket_wrapper/socket_wrapper.c
parent64b985bc168a8247b086832fdb65932428b95958 (diff)
downloadsamba-ac00b6517e08977f44e7a3b106b97b899881d6aa.tar.gz
samba-ac00b6517e08977f44e7a3b106b97b899881d6aa.tar.bz2
samba-ac00b6517e08977f44e7a3b106b97b899881d6aa.zip
r23420: try to make the IBM checker happy
metze (This used to be commit 96f1a0dfaa18a432fca4b5432d929d8daed0abb1)
Diffstat (limited to 'source4/lib/socket_wrapper/socket_wrapper.c')
-rw-r--r--source4/lib/socket_wrapper/socket_wrapper.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/source4/lib/socket_wrapper/socket_wrapper.c b/source4/lib/socket_wrapper/socket_wrapper.c
index 84c323cfed..ec074ecaeb 100644
--- a/source4/lib/socket_wrapper/socket_wrapper.c
+++ b/source4/lib/socket_wrapper/socket_wrapper.c
@@ -174,7 +174,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:
@@ -184,7 +184,7 @@ static int socket_length(int family)
return sizeof(struct sockaddr_in6);
#endif
}
- return -1;
+ return 0;
}
@@ -788,6 +788,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) {
@@ -1231,10 +1234,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;
@@ -1278,7 +1283,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;
}