diff options
author | harti <harti@FreeBSD.org> | 2003-07-29 13:40:52 +0000 |
---|---|---|
committer | harti <harti@FreeBSD.org> | 2003-07-29 13:40:52 +0000 |
commit | 788dcc55962de03e4ce09ad2fe064e44f66629f9 (patch) | |
tree | 085755362ea2e8a107f22a4885b7abd809bdfecf | |
parent | b2770235d4db105b05270cb78d8388c246b186c6 (diff) | |
download | FreeBSD-src-788dcc55962de03e4ce09ad2fe064e44f66629f9.zip FreeBSD-src-788dcc55962de03e4ce09ad2fe064e44f66629f9.tar.gz |
Use a size_t for variables that need to hold buffer lengths.
-rw-r--r-- | usr.sbin/atm/atmarpd/atmarp_log.c | 1 | ||||
-rw-r--r-- | usr.sbin/atm/atmarpd/atmarp_subr.c | 21 | ||||
-rw-r--r-- | usr.sbin/atm/atmarpd/atmarpd.c | 1 | ||||
-rw-r--r-- | usr.sbin/atm/scspd/scsp_subr.c | 15 |
4 files changed, 20 insertions, 18 deletions
diff --git a/usr.sbin/atm/atmarpd/atmarp_log.c b/usr.sbin/atm/atmarpd/atmarp_log.c index d697747..4f8d212 100644 --- a/usr.sbin/atm/atmarpd/atmarp_log.c +++ b/usr.sbin/atm/atmarpd/atmarp_log.c @@ -57,6 +57,7 @@ #endif #include <stdio.h> #include <syslog.h> +#include <stdlib.h> #include "../scspd/scsp_msg.h" #include "../scspd/scsp_if.h" diff --git a/usr.sbin/atm/atmarpd/atmarp_subr.c b/usr.sbin/atm/atmarpd/atmarp_subr.c index 4015a34..6987a4b 100644 --- a/usr.sbin/atm/atmarpd/atmarp_subr.c +++ b/usr.sbin/atm/atmarpd/atmarp_subr.c @@ -182,7 +182,7 @@ atmarp_is_server(aip) Atmarp_intf *aip; { int rc; - int buf_len = sizeof(struct air_asrv_rsp); + size_t buf_len; struct atminfreq air; struct air_asrv_rsp *asrv_info; @@ -191,8 +191,8 @@ atmarp_is_server(aip) */ strcpy(air.air_int_intf, aip->ai_intf); air.air_opcode = AIOCS_INF_ASV; - buf_len = do_info_ioctl(&air, buf_len); - if (buf_len < 0) + buf_len = do_info_ioctl(&air, sizeof(struct air_asrv_rsp)); + if ((ssize_t)buf_len == -1) return(0); /* @@ -222,7 +222,8 @@ int atmarp_if_ready(aip) Atmarp_intf *aip; { - int i, len, mtu, rc, sel; + int i, mtu, rc, sel; + size_t len; Atmarp *aap = (Atmarp *)0; struct atminfreq air; struct air_netif_rsp *netif_rsp = (struct air_netif_rsp *)0; @@ -239,9 +240,8 @@ atmarp_if_ready(aip) air.air_opcode = AIOCS_INF_NIF; strcpy(air.air_netif_intf, aip->ai_intf); len = do_info_ioctl(&air, sizeof(struct air_netif_rsp)); - if (len <= 0) { + if ((ssize_t)len == -1) goto if_ready_fail; - } netif_rsp = (struct air_netif_rsp *)air.air_buf_addr; ip_addr = (struct sockaddr_in *)&netif_rsp->anp_proto_addr; @@ -276,9 +276,8 @@ atmarp_if_ready(aip) air.air_opcode = AIOCS_INF_INT; strcpy(air.air_int_intf, netif_rsp->anp_phy_intf); len = do_info_ioctl(&air, sizeof(struct air_int_rsp)); - if (len <= 0) { + if ((ssize_t)len == -1) goto if_ready_fail; - } intf_rsp = (struct air_int_rsp *)air.air_buf_addr; /* @@ -551,7 +550,8 @@ atmarp_update_kernel(aap) void atmarp_get_updated_cache() { - int i, len, rc; + int i, rc; + size_t len; struct atminfreq air; struct air_arp_rsp *cp; struct sockaddr_in *ipp; @@ -574,9 +574,8 @@ atmarp_get_updated_cache() * Issue an ATMARP information request IOCTL */ len = do_info_ioctl(&air, sizeof(struct air_arp_rsp) * 200); - if (len < 0) { + if ((ssize_t)len == -1) return; - } /* * Clear marks on all our cache entries diff --git a/usr.sbin/atm/atmarpd/atmarpd.c b/usr.sbin/atm/atmarpd/atmarpd.c index 2990665..2cb5f70 100644 --- a/usr.sbin/atm/atmarpd/atmarpd.c +++ b/usr.sbin/atm/atmarpd/atmarpd.c @@ -54,6 +54,7 @@ #include <libatm.h> #include <paths.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <syslog.h> #include <unistd.h> diff --git a/usr.sbin/atm/scspd/scsp_subr.c b/usr.sbin/atm/scspd/scsp_subr.c index 4873ca5..58a5abf 100644 --- a/usr.sbin/atm/scspd/scsp_subr.c +++ b/usr.sbin/atm/scspd/scsp_subr.c @@ -193,7 +193,7 @@ scsp_is_atmarp_server(netif) char *netif; { int rc; - int buf_len = sizeof(struct air_asrv_rsp); + size_t buf_len; struct atminfreq air; struct air_asrv_rsp *asrv_info; @@ -202,8 +202,8 @@ scsp_is_atmarp_server(netif) */ strcpy(air.air_int_intf, netif); air.air_opcode = AIOCS_INF_ASV; - buf_len = do_info_ioctl(&air, buf_len); - if (buf_len < 0) + buf_len = do_info_ioctl(&air, sizeof(struct air_asrv_rsp)); + if ((ssize_t)buf_len == -1) return(0); /* @@ -678,7 +678,8 @@ int scsp_get_server_info(ssp) Scsp_server *ssp; { - int i, len, mtu, rc, sel; + int i, mtu, rc, sel; + size_t len; struct atminfreq air; struct air_netif_rsp *netif_rsp = (struct air_netif_rsp *)0; struct air_int_rsp *intf_rsp = (struct air_int_rsp *)0; @@ -702,7 +703,7 @@ scsp_get_server_info(ssp) air.air_opcode = AIOCS_INF_NIF; strcpy(air.air_netif_intf, ssp->ss_intf); len = do_info_ioctl(&air, sizeof(struct air_netif_rsp)); - if (len <= 0) { + if ((ssize_t)len == -1 || len == 0) { rc = EIO; goto server_info_done; } @@ -732,7 +733,7 @@ scsp_get_server_info(ssp) air.air_opcode = AIOCS_INF_INT; strcpy(air.air_int_intf, netif_rsp->anp_phy_intf); len = do_info_ioctl(&air, sizeof(struct air_int_rsp)); - if (len <= 0) { + if ((ssize_t)len == -1 || len == 0) { rc = EIO; goto server_info_done; } @@ -786,7 +787,7 @@ scsp_get_server_info(ssp) air.air_opcode = AIOCS_INF_CFG; strcpy(air.air_int_intf, netif_rsp->anp_phy_intf); len = do_info_ioctl(&air, sizeof(struct air_cfg_rsp)); - if (len <= 0) { + if ((ssize_t)len == -1 || len == 0) { rc = EIO; goto server_info_done; } |