Use socklen_t where appropriate.

This commit is contained in:
Stefan Farfeleder 2005-03-11 14:17:12 +00:00
parent c2d34cc331
commit 595e532309
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=143415
5 changed files with 18 additions and 12 deletions

View File

@ -293,7 +293,7 @@ _yp_dobind(char *dom, struct dom_binding **ypdb)
int new = 0, r;
int retries = 0;
struct sockaddr_in check;
int checklen = sizeof(struct sockaddr_in);
socklen_t checklen = sizeof(struct sockaddr_in);
/* Not allowed; bad doggie. Bad. */
if (strchr(dom, '/') != NULL)
@ -559,7 +559,7 @@ static void
_yp_unbind(struct dom_binding *ypb)
{
struct sockaddr_in check;
int checklen = sizeof(struct sockaddr_in);
socklen_t checklen = sizeof(struct sockaddr_in);
if (ypb->dom_client != NULL) {
/* Check the socket -- may have been hosed by the caller. */

View File

@ -53,7 +53,8 @@ get_iface(dst, iface)
{
static struct sockaddr_in local;
struct sockaddr_in remote;
int s, rv, namelen;
socklen_t namelen;
int s, rv;
memcpy(&remote.sin_addr, dst, sizeof remote.sin_addr);
remote.sin_port = htons(60000);

View File

@ -576,12 +576,13 @@ dconschat_init_socket(struct dcons_state *dc, int port, char *host, int sport)
static int
dconschat_accept_socket(struct dcons_state *dc, struct dcons_port *p)
{
int foo, ns, flags;
socklen_t addrlen;
int ns, flags;
struct kevent kev;
/* accept connection */
foo = p->res->ai_addrlen;
ns = accept(p->s, p->res->ai_addr, &foo);
addrlen = p->res->ai_addrlen;
ns = accept(p->s, p->res->ai_addr, &addrlen);
if (ns < 0)
err(1, "accept");
if (verbose)

View File

@ -346,8 +346,8 @@ yp_run_dnsq(void)
char buf[sizeof(HEADER) + MAXPACKET];
char retrybuf[MAXHOSTNAMELEN];
struct sockaddr_in sin;
socklen_t len;
int rval;
int len;
HEADER *hptr;
struct hostent *hent;
@ -411,10 +411,12 @@ ypstat
yp_async_lookup_name(struct svc_req *rqstp, char *name)
{
register struct circleq_dnsentry *q;
int type, len;
socklen_t len;
int type;
/* Check for SOCK_DGRAM or SOCK_STREAM -- we need to know later */
type = -1; len = sizeof(type);
type = -1;
len = sizeof(type);
if (getsockopt(rqstp->rq_xprt->xp_fd, SOL_SOCKET,
SO_TYPE, &type, &len) == -1) {
yp_error("getsockopt failed: %s", strerror(errno));
@ -465,11 +467,13 @@ yp_async_lookup_addr(struct svc_req *rqstp, char *addr)
{
register struct circleq_dnsentry *q;
char buf[MAXHOSTNAMELEN];
socklen_t len;
int a, b, c, d;
int type, len;
int type;
/* Check for SOCK_DGRAM or SOCK_STREAM -- we need to know later */
type = -1; len = sizeof(type);
type = -1;
len = sizeof(type);
if (getsockopt(rqstp->rq_xprt->xp_fd, SOL_SOCKET,
SO_TYPE, &type, &len) == -1) {
yp_error("getsockopt failed: %s", strerror(errno));

View File

@ -229,7 +229,7 @@ main(int argc, char *argv[])
int sock;
int proto = 0;
struct sockaddr_in saddr;
int asize = sizeof (saddr);
socklen_t asize = sizeof (saddr);
int ch;
while ((ch = getopt(argc, argv, "hdnp:")) != -1) {