From: millert Date: Sun, 23 Mar 1997 03:52:13 +0000 (+0000) Subject: Minor updates from lite2 + some KNF and strdup(3) checking. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=9ad0801ea5707b34c54f5bf963b6c9752798f71a;p=openbsd Minor updates from lite2 + some KNF and strdup(3) checking. Also, no need to change umask now that we use mkstemp(3). --- diff --git a/sbin/mount_portal/activate.c b/sbin/mount_portal/activate.c index fd4f20a7bec..4a6960b8115 100644 --- a/sbin/mount_portal/activate.c +++ b/sbin/mount_portal/activate.c @@ -1,9 +1,10 @@ -/* $OpenBSD: activate.c,v 1.2 1996/06/23 14:31:30 deraadt Exp $ */ +/* $OpenBSD: activate.c,v 1.3 1997/03/23 03:52:13 millert Exp $ */ /* $NetBSD: activate.c,v 1.5 1995/04/23 10:33:18 cgd Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. + * All rights reserved. * * This code is derived from software donated to Berkeley by * Jan-Simon Pendry. @@ -37,7 +38,7 @@ * SUCH DAMAGE. * * from: Id: activate.c,v 1.2 1992/05/27 07:09:27 jsp Exp - * @(#)activate.c 8.2 (Berkeley) 3/27/94 + * @(#)activate.c 8.3 (Berkeley) 4/28/95 */ #include @@ -59,12 +60,13 @@ * Scan the providers list and call the * appropriate function. */ -static int activate_argv(pcr, key, v, so, fdp) -struct portal_cred *pcr; -char *key; -char **v; -int so; -int *fdp; +static int +activate_argv(pcr, key, v, so, fdp) + struct portal_cred *pcr; + char *key; + char **v; + int so; + int *fdp; { provider *pr; @@ -75,22 +77,23 @@ int *fdp; return (ENOENT); } -static int get_request(so, pcr, key, klen) -int so; -struct portal_cred *pcr; -char *key; -int klen; +static int +get_request(so, pcr, key, klen) + int so; + struct portal_cred *pcr; + char *key; + int klen; { struct iovec iov[2]; struct msghdr msg; int n; - iov[0].iov_base = (caddr_t) pcr; + iov[0].iov_base = (caddr_t)pcr; iov[0].iov_len = sizeof(*pcr); iov[1].iov_base = key; iov[1].iov_len = klen; - memset(&msg, 0, sizeof(msg)); + (void)memset(&msg, 0, sizeof(msg)); msg.msg_iov = iov; msg.msg_iovlen = 2; @@ -107,10 +110,11 @@ int klen; return (0); } -static void send_reply(so, fd, error) -int so; -int fd; -int error; +static void +send_reply(so, fd, error) + int so; + int fd; + int error; { int n; struct iovec iov; @@ -124,13 +128,13 @@ int error; * Line up error code. Don't worry about byte ordering * because we must be sending to the local machine. */ - iov.iov_base = (caddr_t) &error; + iov.iov_base = (caddr_t)&error; iov.iov_len = sizeof(error); /* * Build a msghdr */ - memset(&msg, 0, sizeof(msg)); + (void)memset(&msg, 0, sizeof(msg)); msg.msg_iov = &iov; msg.msg_iovlen = 1; @@ -143,7 +147,7 @@ int error; ctl.cmsg.cmsg_len = sizeof(ctl); ctl.cmsg.cmsg_level = SOL_SOCKET; ctl.cmsg.cmsg_type = SCM_RIGHTS; - msg.msg_control = (caddr_t) &ctl; + msg.msg_control = (caddr_t)&ctl; msg.msg_controllen = ctl.cmsg.cmsg_len; } @@ -151,24 +155,25 @@ int error; * Send to kernel... */ if ((n = sendmsg(so, &msg, MSG_EOR)) < 0) - syslog(LOG_ERR, "send: %s", strerror(errno)); + syslog(LOG_ERR, "send: %m"); #ifdef DEBUG - fprintf(stderr, "sent %d bytes\n", n); + (void)fprintf(stderr, "sent %d bytes\n", n); #endif - sleep(1); /*XXX*/ + sleep(1); /* XXX */ #ifdef notdef if (shutdown(so, 2) < 0) - syslog(LOG_ERR, "shutdown: %s", strerror(errno)); + syslog(LOG_ERR, "shutdown: %m"); #endif /* * Throw away the open file descriptor */ - (void) close(fd); + (void)close(fd); } -void activate(q, so) -qelem *q; -int so; +void +activate(q, so) + qelem *q; + int so; { struct portal_cred pcred; char key[MAXPATHLEN+1]; @@ -181,12 +186,12 @@ int so; */ error = get_request(so, &pcred, key, sizeof(key)); if (error) { - syslog(LOG_ERR, "activate: recvmsg: %s", strerror(error)); + syslog(LOG_ERR, "activate: recvmsg: %m"); goto drop; } #ifdef DEBUG - fprintf(stderr, "lookup key %s\n", key); + (void)fprintf(stderr, "lookup key %s\n", key); #endif /* diff --git a/sbin/mount_portal/conf.c b/sbin/mount_portal/conf.c index 18f9c3bdea1..62d3d286eb2 100644 --- a/sbin/mount_portal/conf.c +++ b/sbin/mount_portal/conf.c @@ -1,9 +1,10 @@ -/* $OpenBSD: conf.c,v 1.3 1997/03/23 03:04:28 millert Exp $ */ +/* $OpenBSD: conf.c,v 1.4 1997/03/23 03:52:13 millert Exp $ */ /* $NetBSD: conf.c,v 1.4 1995/04/23 10:33:19 cgd Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. + * All rights reserved. * * This code is derived from software donated to Berkeley by * Jan-Simon Pendry. @@ -73,8 +74,9 @@ static path *curp; /* XXX for regerror */ * Add an element to a 2-way list, * just after (pred) */ -static void ins_que(elem, pred) -qelem *elem, *pred; +static void +ins_que(elem, pred) + qelem *elem, *pred; { qelem *p = pred->q_forw; elem->q_back = pred; @@ -86,8 +88,9 @@ qelem *elem, *pred; /* * Remove an element from a 2-way list */ -static void rem_que(elem) -qelem *elem; +static void +rem_que(elem) + qelem *elem; { qelem *p = elem->q_forw; qelem *p2 = elem->q_back; @@ -98,8 +101,9 @@ qelem *elem; /* * Error checking malloc */ -static void *xmalloc(siz) -unsigned siz; +static void * +xmalloc(siz) + size_t siz; { void *p = malloc(siz); if (p) @@ -115,9 +119,10 @@ unsigned siz; * not found then the path is added to the end of the list * and 1 is returned. */ -static int pinsert(p0, q0) -path *p0; -qelem *q0; +static int +pinsert(p0, q0) + path *p0; + qelem *q0; { qelem *q; @@ -125,7 +130,7 @@ qelem *q0; return (0); for (q = q0->q_forw; q != q0; q = q->q_forw) { - path *p = (path *) q; + path *p = (path *)q; if (strcmp(p->p_key, p0->p_key) == 0) return (0); } @@ -134,16 +139,18 @@ qelem *q0; } -void regerror(s) -const char *s; +void +regerror(s) + const char *s; { syslog(LOG_ERR, "%s:%d: regcomp %s: %s", conf_file, curp->p_lno, curp->p_key, s); } -static path *palloc(cline, lno) -char *cline; -int lno; +static path * +palloc(cline, lno) + char *cline; + int lno; { int c; char *s; @@ -164,6 +171,11 @@ int lno; */ c = 0; key = strdup(cline); + if (key == NULL) { + syslog(LOG_ALERT, "malloc: failed to get %d bytes", + strlen(cline)); + exit(1); + } for (s = key; s != NULL; ) { char *val; while ((val = strsep(&s, " \t\n")) != NULL && *val == '\0') @@ -184,6 +196,11 @@ int lno; p->p_argc = 0; p->p_argv = xmalloc(c * sizeof(char *)); p->p_args = strdup(cline); + if (p->p_args == NULL) { + syslog(LOG_ALERT, "malloc: failed to get %d bytes", + strlen(cline)); + exit(1); + } ap = p->p_argv; for (s = p->p_args; s != NULL; ) { char *val; @@ -198,7 +215,7 @@ int lno; #ifdef DEBUG for (c = 0; c < p->p_argc; c++) - printf("%sv[%d] = %s\n", c?"\t":"", c, p->p_argv[c]); + (void)printf("%sv[%d] = %s\n", c?"\t":"", c, p->p_argv[c]); #endif p->p_key = p->p_argv[0]; @@ -217,23 +234,25 @@ int lno; /* * Free a path structure */ -static void pfree(p) -path *p; +static void +pfree(p) + path *p; { free(p->p_args); if (p->p_re) - free((char *) p->p_re); - free((char *) p->p_argv); - free((char *) p); + free((void *)p->p_re); + free((void *)p->p_argv); + free((void *)p); } /* * Discard all currently held path structures on q0. * and add all the ones on xq. */ -static void preplace(q0, xq) -qelem *q0; -qelem *xq; +static void +preplace(q0, xq) + qelem *q0; + qelem *xq; { /* * While the list is not empty, @@ -243,7 +262,7 @@ qelem *xq; while (q0->q_forw != q0) { qelem *q = q0->q_forw; rem_que(q); - pfree((path *) q); + pfree((path *)q); } while (xq->q_forw != xq) { qelem *q = xq->q_forw; @@ -256,9 +275,10 @@ qelem *xq; * Read the lines from the configuration file and * add them to the list of paths. */ -static void readfp(q0, fp) -qelem *q0; -FILE *fp; +static void +readfp(q0, fp) + qelem *q0; + FILE *fp; { char cline[LINE_MAX]; int nread = 0; @@ -293,18 +313,19 @@ FILE *fp; * the existing path list with the new version. * If the file is not readable, then no changes take place */ -void conf_read(q, conf) -qelem *q; -char *conf; +void +conf_read(q, conf) + qelem *q; + char *conf; { FILE *fp = fopen(conf, "r"); if (fp) { conf_file = conf; /* XXX */ readfp(q, fp); conf_file = 0; /* XXX */ - (void) fclose(fp); + (void)fclose(fp); } else { - syslog(LOG_ERR, "open config file \"%s\": %s", conf, strerror(errno)); + syslog(LOG_ERR, "open config file \"%s\": %m", conf); } } @@ -316,7 +337,7 @@ char *key; qelem *q; for (q = q0->q_forw; q != q0; q = q->q_forw) { - path *p = (path *) q; + path *p = (path *)q; if (p->p_re) { if (regexec(p->p_re, key)) return (p->p_argv+1); diff --git a/sbin/mount_portal/mount_portal.8 b/sbin/mount_portal/mount_portal.8 index 5e08f606ba0..1c0b3145f25 100644 --- a/sbin/mount_portal/mount_portal.8 +++ b/sbin/mount_portal/mount_portal.8 @@ -1,8 +1,9 @@ -.\" $OpenBSD: mount_portal.8,v 1.2 1996/06/23 14:31:32 deraadt Exp $ +.\" $OpenBSD: mount_portal.8,v 1.3 1997/03/23 03:52:14 millert Exp $ .\" $NetBSD: mount_portal.8,v 1.6 1995/08/18 15:01:19 pk Exp $ .\" .\" Copyright (c) 1993, 1994 .\" The Regents of the University of California. All rights reserved. +.\" All rights reserved. .\" .\" This code is derived from software donated to Berkeley by .\" Jan-Simon Pendry. diff --git a/sbin/mount_portal/mount_portal.c b/sbin/mount_portal/mount_portal.c index a5b801d19c9..959f8f563f1 100644 --- a/sbin/mount_portal/mount_portal.c +++ b/sbin/mount_portal/mount_portal.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mount_portal.c,v 1.6 1997/03/23 03:04:29 millert Exp $ */ +/* $OpenBSD: mount_portal.c,v 1.7 1997/03/23 03:52:14 millert Exp $ */ /* $NetBSD: mount_portal.c,v 1.8 1996/04/13 01:31:54 jtc Exp $ */ /* @@ -45,9 +45,9 @@ char copyright[] = #ifndef lint #if 0 -static char sccsid[] = "@(#)mount_portal.c 8.4 (Berkeley) 3/27/94"; +static char sccsid[] = "@(#)mount_portal.c 8.6 (Berkeley) 4/26/95"; #else -static char rcsid[] = "$OpenBSD: mount_portal.c,v 1.6 1997/03/23 03:04:29 millert Exp $"; +static char rcsid[] = "$OpenBSD: mount_portal.c,v 1.7 1997/03/23 03:52:14 millert Exp $"; #endif #endif /* not lint */ @@ -56,7 +56,6 @@ static char rcsid[] = "$OpenBSD: mount_portal.c,v 1.6 1997/03/23 03:04:29 miller #include #include #include -#include #include #include @@ -93,7 +92,7 @@ sigchld(sig) while ((pid = waitpid((pid_t) -1, (int *) 0, WNOHANG)) > 0) ; if (pid < 0 && errno != ECHILD) - syslog(LOG_WARNING, "waitpid: %s", strerror(errno)); + syslog(LOG_WARNING, "waitpid: %m"); } static void @@ -110,8 +109,8 @@ sigterm(sig) { if (unmount(mountpt, MNT_FORCE) < 0) - syslog(LOG_WARNING, "sigterm: unmounting %s failed: %s", - mountpt, strerror(errno)); + syslog(LOG_WARNING, "sigterm: unmounting %s failed: %m", + mountpt); } int @@ -124,7 +123,6 @@ main(argc, argv) char *conf; int mntflags = 0; char tag[32]; - mode_t um; qelem q; int rc; @@ -165,7 +163,7 @@ main(argc, argv) un.sun_family = AF_UNIX; if (sizeof(_PATH_TMPPORTAL) >= sizeof(un.sun_path)) errx(1, "portal socket name too long"); - strcpy(un.sun_path, _PATH_TMPPORTAL); + (void)strcpy(un.sun_path, _PATH_TMPPORTAL); so = mkstemp(un.sun_path); if (so < 0) err(1, "can't create portal socket name: %s", un.sun_path); @@ -176,17 +174,15 @@ main(argc, argv) if (so < 0) err(1, "socket(2)"); - um = umask(077); (void)unlink(un.sun_path); if (bind(so, (struct sockaddr *) &un, sizeof(un)) < 0) err(1, "bind(2)"); (void)unlink(un.sun_path); - (void)umask(um); (void)listen(so, 5); args.pa_socket = so; - (void)sprintf(tag, "portal:%d", getpid() + 1); + (void)snprintf(tag, sizeof(tag), "portal:%d", getpid() + 1); args.pa_config = tag; rc = mount(MOUNT_PORTAL, mountpt, mntflags, &args); @@ -242,7 +238,7 @@ main(argc, argv) if (rc < 0) { if (errno == EINTR) continue; - syslog(LOG_ERR, "select: %s", strerror(errno)); + syslog(LOG_ERR, "select: %m"); exit(1); } if (rc == 0) @@ -256,7 +252,7 @@ main(argc, argv) if (errno == ECONNABORTED) break; if (errno != EINTR) { - syslog(LOG_ERR, "accept: %s", strerror(errno)); + syslog(LOG_ERR, "accept: %m"); exit(1); } continue; @@ -272,7 +268,7 @@ main(argc, argv) sleep(1); goto eagain; } - syslog(LOG_ERR, "fork: %s", strerror(errno)); + syslog(LOG_ERR, "fork: %m"); break; case 0: (void)close(so); diff --git a/sbin/mount_portal/pathnames.h b/sbin/mount_portal/pathnames.h index 3e127e56eae..990ac034093 100644 --- a/sbin/mount_portal/pathnames.h +++ b/sbin/mount_portal/pathnames.h @@ -1,9 +1,10 @@ -/* $OpenBSD: pathnames.h,v 1.3 1997/03/23 03:04:29 millert Exp $ */ +/* $OpenBSD: pathnames.h,v 1.4 1997/03/23 03:52:15 millert Exp $ */ /* $NetBSD: pathnames.h,v 1.4 1995/04/23 10:33:21 cgd Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. + * All rights reserved. * * This code is derived from software donated to Berkeley by * Jan-Simon Pendry. diff --git a/sbin/mount_portal/portald.h b/sbin/mount_portal/portald.h index 0892e10e76c..273fdb8f3a4 100644 --- a/sbin/mount_portal/portald.h +++ b/sbin/mount_portal/portald.h @@ -1,9 +1,10 @@ -/* $OpenBSD: portald.h,v 1.2 1996/06/23 14:31:34 deraadt Exp $ */ +/* $OpenBSD: portald.h,v 1.3 1997/03/23 03:52:15 millert Exp $ */ /* $NetBSD: portald.h,v 1.4 1995/04/23 10:33:23 cgd Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. + * All rights reserved. * * This code is derived from software donated to Berkeley by * Jan-Simon Pendry. diff --git a/sbin/mount_portal/pt_conf.c b/sbin/mount_portal/pt_conf.c index 5a7992cef21..ccb5062f97a 100644 --- a/sbin/mount_portal/pt_conf.c +++ b/sbin/mount_portal/pt_conf.c @@ -1,9 +1,10 @@ -/* $OpenBSD: pt_conf.c,v 1.2 1996/06/23 14:31:35 deraadt Exp $ */ +/* $OpenBSD: pt_conf.c,v 1.3 1997/03/23 03:52:16 millert Exp $ */ /* $NetBSD: pt_conf.c,v 1.4 1995/04/23 10:33:24 cgd Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. + * All rights reserved. * * This code is derived from software donated to Berkeley by * Jan-Simon Pendry. diff --git a/sbin/mount_portal/pt_exec.c b/sbin/mount_portal/pt_exec.c index 5c3272c3f8b..55110c10cec 100644 --- a/sbin/mount_portal/pt_exec.c +++ b/sbin/mount_portal/pt_exec.c @@ -1,9 +1,10 @@ -/* $OpenBSD: pt_exec.c,v 1.2 1996/06/23 14:31:35 deraadt Exp $ */ +/* $OpenBSD: pt_exec.c,v 1.3 1997/03/23 03:52:16 millert Exp $ */ /* $NetBSD: pt_exec.c,v 1.4 1995/04/23 10:33:25 cgd Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. + * All rights reserved. * * This code is derived from software donated to Berkeley by * Jan-Simon Pendry. @@ -50,13 +51,13 @@ #include "portald.h" -int portal_exec(pcr, key, v, so, fdp) -struct portal_cred *pcr; -char *key; -char **v; -int so; -int *fdp; +int +portal_exec(pcr, key, v, so, fdp) + struct portal_cred *pcr; + char *key; + char **v; + int so; + int *fdp; { return (ENOEXEC); } - diff --git a/sbin/mount_portal/pt_file.c b/sbin/mount_portal/pt_file.c index 22fd16d84f8..e40800502fc 100644 --- a/sbin/mount_portal/pt_file.c +++ b/sbin/mount_portal/pt_file.c @@ -1,9 +1,10 @@ -/* $OpenBSD: pt_file.c,v 1.3 1997/03/23 03:04:30 millert Exp $ */ +/* $OpenBSD: pt_file.c,v 1.4 1997/03/23 03:52:16 millert Exp $ */ /* $NetBSD: pt_file.c,v 1.7 1995/06/06 19:54:30 mycroft Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. + * All rights reserved. * * This code is derived from software donated to Berkeley by * Jan-Simon Pendry. @@ -37,7 +38,7 @@ * SUCH DAMAGE. * * from: Id: pt_file.c,v 1.1 1992/05/25 21:43:09 jsp Exp - * @(#)pt_file.c 8.2 (Berkeley) 3/27/94 + * @(#)pt_file.c 8.3 (Berkeley) 7/3/94 */ #include @@ -52,22 +53,24 @@ #include "portald.h" -int portal_file(pcr, key, v, so, fdp) -struct portal_cred *pcr; -char *key; -char **v; -int so; -int *fdp; +int +portal_file(pcr, key, v, so, fdp) + struct portal_cred *pcr; + char *key; + char **v; + int so; + int *fdp; { int fd; char pbuf[MAXPATHLEN]; int error; pbuf[0] = '/'; - strcpy(pbuf+1, key + (v[1] ? strlen(v[1]) : 0)); + (void)strcpy(pbuf+1, key + (v[1] ? strlen(v[1]) : 0)); #ifdef DEBUG - printf("path = %s, uid = %d, gid = %d\n", pbuf, pcr->pcr_uid, pcr->pcr_gid); + (void)printf("path = %s, uid = %d, gid = %d\n", pbuf, pcr->pcr_uid, + pcr->pcr_gid); #endif if (setegid(pcr->pcr_gid) < 0 || @@ -85,9 +88,9 @@ int *fdp; if (seteuid((uid_t) 0) < 0) { /* XXX - should reset gidset too */ error = errno; - syslog(LOG_ERR, "setcred: %s", strerror(error)); + syslog(LOG_ERR, "setcred: %m"); if (fd >= 0) { - (void) close(fd); + (void)close(fd); fd = -1; } } @@ -96,7 +99,8 @@ int *fdp; *fdp = fd; #ifdef DEBUG - fprintf(stderr, "pt_file returns *fdp = %d, error = %d\n", *fdp, error); + (void)fprintf(stderr, "pt_file returns *fdp = %d, error = %d\n", + *fdp, error); #endif return (error); diff --git a/sbin/mount_portal/pt_tcp.c b/sbin/mount_portal/pt_tcp.c index d7b85c63ea0..5cd3d8c754d 100644 --- a/sbin/mount_portal/pt_tcp.c +++ b/sbin/mount_portal/pt_tcp.c @@ -1,9 +1,10 @@ -/* $OpenBSD: pt_tcp.c,v 1.2 1996/06/23 14:31:36 deraadt Exp $ */ +/* $OpenBSD: pt_tcp.c,v 1.3 1997/03/23 03:52:17 millert Exp $ */ /* $NetBSD: pt_tcp.c,v 1.9 1995/05/21 15:33:22 mycroft Exp $ */ /* - * Copyright (c) 1992, 1993 + * Copyright (c) 1992, 1993, 1994 * The Regents of the University of California. All rights reserved. + * All rights reserved. * * This code is derived from software donated to Berkeley by * Jan-Simon Pendry. @@ -37,7 +38,7 @@ * SUCH DAMAGE. * * from: Id: pt_tcp.c,v 1.1 1992/05/25 21:43:09 jsp Exp - * @(#)pt_tcp.c 8.3 (Berkeley) 3/27/94 + * @(#)pt_tcp.c 8.5 (Berkeley) 4/28/95 */ #include @@ -62,12 +63,13 @@ * Some trailing suffix values have special meanings. * An unrecognised suffix is an error. */ -int portal_tcp(pcr, key, v, kso, fdp) -struct portal_cred *pcr; -char *key; -char **v; -int kso; -int *fdp; +int +portal_tcp(pcr, key, v, kso, fdp) + struct portal_cred *pcr; + char *key; + char **v; + int kso; + int *fdp; { char host[MAXHOSTNAMELEN]; char port[MAXHOSTNAMELEN]; @@ -86,7 +88,7 @@ int *fdp; if (q == 0 || q - p >= sizeof(host)) return (EINVAL); *q = '\0'; - strcpy(host, p); + (void)strcpy(host, p); p = q + 1; q = strchr(p, '/'); @@ -94,7 +96,7 @@ int *fdp; *q = '\0'; if (strlen(p) >= sizeof(port)) return (EINVAL); - strcpy(port, p); + (void)strcpy(port, p); if (q) { p = q + 1; if (strcmp(p, "priv") == 0) { @@ -111,7 +113,7 @@ int *fdp; hp = gethostbyname(host); if (hp == 0) return (EINVAL); - ipp = (struct in_addr **) hp->h_addr_list; + ipp = (struct in_addr **)hp->h_addr_list; } else { ip[0] = &ina; ip[1] = 0; @@ -122,12 +124,13 @@ int *fdp; if (sp != 0) s_port = sp->s_port; else { - s_port = htons(atoi(port)); - if (s_port == 0) + s_port = strtoul(port, &p, 0); + if (s_port == 0 || *p != '\0') return (EINVAL); + s_port = htons(s_port); } - memset(&sain, 0, sizeof(sain)); + (void)memset(&sain, 0, sizeof(sain)); sain.sin_len = sizeof(sain); sain.sin_family = AF_INET; sain.sin_port = s_port; @@ -149,7 +152,7 @@ int *fdp; *fdp = so; return (0); } - (void) close(so); + (void)close(so); ipp++; }