Use socklen_t where appropriate.
This commit is contained in:
parent
c2d34cc331
commit
595e532309
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=143415
@ -293,7 +293,7 @@ _yp_dobind(char *dom, struct dom_binding **ypdb)
|
|||||||
int new = 0, r;
|
int new = 0, r;
|
||||||
int retries = 0;
|
int retries = 0;
|
||||||
struct sockaddr_in check;
|
struct sockaddr_in check;
|
||||||
int checklen = sizeof(struct sockaddr_in);
|
socklen_t checklen = sizeof(struct sockaddr_in);
|
||||||
|
|
||||||
/* Not allowed; bad doggie. Bad. */
|
/* Not allowed; bad doggie. Bad. */
|
||||||
if (strchr(dom, '/') != NULL)
|
if (strchr(dom, '/') != NULL)
|
||||||
@ -559,7 +559,7 @@ static void
|
|||||||
_yp_unbind(struct dom_binding *ypb)
|
_yp_unbind(struct dom_binding *ypb)
|
||||||
{
|
{
|
||||||
struct sockaddr_in check;
|
struct sockaddr_in check;
|
||||||
int checklen = sizeof(struct sockaddr_in);
|
socklen_t checklen = sizeof(struct sockaddr_in);
|
||||||
|
|
||||||
if (ypb->dom_client != NULL) {
|
if (ypb->dom_client != NULL) {
|
||||||
/* Check the socket -- may have been hosed by the caller. */
|
/* Check the socket -- may have been hosed by the caller. */
|
||||||
|
@ -53,7 +53,8 @@ get_iface(dst, iface)
|
|||||||
{
|
{
|
||||||
static struct sockaddr_in local;
|
static struct sockaddr_in local;
|
||||||
struct sockaddr_in remote;
|
struct sockaddr_in remote;
|
||||||
int s, rv, namelen;
|
socklen_t namelen;
|
||||||
|
int s, rv;
|
||||||
|
|
||||||
memcpy(&remote.sin_addr, dst, sizeof remote.sin_addr);
|
memcpy(&remote.sin_addr, dst, sizeof remote.sin_addr);
|
||||||
remote.sin_port = htons(60000);
|
remote.sin_port = htons(60000);
|
||||||
|
@ -576,12 +576,13 @@ dconschat_init_socket(struct dcons_state *dc, int port, char *host, int sport)
|
|||||||
static int
|
static int
|
||||||
dconschat_accept_socket(struct dcons_state *dc, struct dcons_port *p)
|
dconschat_accept_socket(struct dcons_state *dc, struct dcons_port *p)
|
||||||
{
|
{
|
||||||
int foo, ns, flags;
|
socklen_t addrlen;
|
||||||
|
int ns, flags;
|
||||||
struct kevent kev;
|
struct kevent kev;
|
||||||
|
|
||||||
/* accept connection */
|
/* accept connection */
|
||||||
foo = p->res->ai_addrlen;
|
addrlen = p->res->ai_addrlen;
|
||||||
ns = accept(p->s, p->res->ai_addr, &foo);
|
ns = accept(p->s, p->res->ai_addr, &addrlen);
|
||||||
if (ns < 0)
|
if (ns < 0)
|
||||||
err(1, "accept");
|
err(1, "accept");
|
||||||
if (verbose)
|
if (verbose)
|
||||||
|
@ -346,8 +346,8 @@ yp_run_dnsq(void)
|
|||||||
char buf[sizeof(HEADER) + MAXPACKET];
|
char buf[sizeof(HEADER) + MAXPACKET];
|
||||||
char retrybuf[MAXHOSTNAMELEN];
|
char retrybuf[MAXHOSTNAMELEN];
|
||||||
struct sockaddr_in sin;
|
struct sockaddr_in sin;
|
||||||
|
socklen_t len;
|
||||||
int rval;
|
int rval;
|
||||||
int len;
|
|
||||||
HEADER *hptr;
|
HEADER *hptr;
|
||||||
struct hostent *hent;
|
struct hostent *hent;
|
||||||
|
|
||||||
@ -411,10 +411,12 @@ ypstat
|
|||||||
yp_async_lookup_name(struct svc_req *rqstp, char *name)
|
yp_async_lookup_name(struct svc_req *rqstp, char *name)
|
||||||
{
|
{
|
||||||
register struct circleq_dnsentry *q;
|
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 */
|
/* 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,
|
if (getsockopt(rqstp->rq_xprt->xp_fd, SOL_SOCKET,
|
||||||
SO_TYPE, &type, &len) == -1) {
|
SO_TYPE, &type, &len) == -1) {
|
||||||
yp_error("getsockopt failed: %s", strerror(errno));
|
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;
|
register struct circleq_dnsentry *q;
|
||||||
char buf[MAXHOSTNAMELEN];
|
char buf[MAXHOSTNAMELEN];
|
||||||
|
socklen_t len;
|
||||||
int a, b, c, d;
|
int a, b, c, d;
|
||||||
int type, len;
|
int type;
|
||||||
|
|
||||||
/* Check for SOCK_DGRAM or SOCK_STREAM -- we need to know later */
|
/* 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,
|
if (getsockopt(rqstp->rq_xprt->xp_fd, SOL_SOCKET,
|
||||||
SO_TYPE, &type, &len) == -1) {
|
SO_TYPE, &type, &len) == -1) {
|
||||||
yp_error("getsockopt failed: %s", strerror(errno));
|
yp_error("getsockopt failed: %s", strerror(errno));
|
||||||
|
@ -229,7 +229,7 @@ main(int argc, char *argv[])
|
|||||||
int sock;
|
int sock;
|
||||||
int proto = 0;
|
int proto = 0;
|
||||||
struct sockaddr_in saddr;
|
struct sockaddr_in saddr;
|
||||||
int asize = sizeof (saddr);
|
socklen_t asize = sizeof (saddr);
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "hdnp:")) != -1) {
|
while ((ch = getopt(argc, argv, "hdnp:")) != -1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user