diff --git a/lib/libatm/Makefile b/lib/libatm/Makefile index 1de2e13177cb..6957c60249a5 100644 --- a/lib/libatm/Makefile +++ b/lib/libatm/Makefile @@ -33,5 +33,6 @@ INCS= libatm.h LDADD+= -lmd DPADD+= ${LIBMD} +WARNS?= 5 .include diff --git a/lib/libatm/atm_addr.c b/lib/libatm/atm_addr.c index f92c4b13c973..ef860a60d494 100644 --- a/lib/libatm/atm_addr.c +++ b/lib/libatm/atm_addr.c @@ -183,6 +183,10 @@ get_hex_atm_addr(in, out, len) val += c_value; out[out_len] = (u_char) val; out_len++; + if (out_len > len) + (void)fprintf(stderr, "%s() out_len > len (%d > %d)\n", + __func__, out_len, len); + break; case 4: @@ -305,7 +309,8 @@ format_atm_addr(addr) u2.c[3] = atm_spans->aas_addr[7]; if (!(u1.w == 0 && u2.w == 0)) - sprintf(str, "0x%08lx.%08lx", ntohl(u1.w), ntohl(u2.w)); + sprintf(str, "0x%08lx.%08lx", + (u_long)ntohl(u1.w), (u_long)ntohl(u2.w)); break; case T_ATM_PVC_ADDR: diff --git a/lib/libatm/cache_key.c b/lib/libatm/cache_key.c index 680f44a11984..da08df216f1e 100644 --- a/lib/libatm/cache_key.c +++ b/lib/libatm/cache_key.c @@ -85,7 +85,7 @@ scsp_cache_key(ap, ip, ol, op) * Copy the addresses into a buffer for MD5 computation */ len = sizeof(struct in_addr) + ap->address_length; - if (len > sizeof(buff)) + if (len > (int)sizeof(buff)) len = sizeof(buff); bcopy(ip, buff, sizeof(struct in_addr)); bcopy(ap->address, &buff[sizeof(struct in_addr)], diff --git a/lib/libatm/ip_addr.c b/lib/libatm/ip_addr.c index 23288a81202c..df10acb7e677 100644 --- a/lib/libatm/ip_addr.c +++ b/lib/libatm/ip_addr.c @@ -73,18 +73,18 @@ get_ip_addr(p) char *p; { struct hostent *ip_host; - static struct sockaddr_in sin; + static struct sockaddr_in s; /* * Get IP address of specified host name */ - bzero(&sin, sizeof(sin)); - sin.sin_family = AF_INET; + bzero(&s, sizeof(s)); + s.sin_family = AF_INET; if (p[0] >= '0' && p[0] <= '9') { /* * IP address is in dotted decimal format */ - if ((sin.sin_addr.s_addr = inet_addr(p)) == -1) { + if ((s.sin_addr.s_addr = inet_addr(p)) == INADDR_NONE) { return((struct sockaddr_in *)0); } } else { @@ -96,9 +96,9 @@ get_ip_addr(p) ip_host->h_addrtype != AF_INET) { return((struct sockaddr_in *)0); } - sin.sin_addr.s_addr = *(u_long *)ip_host->h_addr_list[0]; + s.sin_addr.s_addr = *(u_long *)ip_host->h_addr_list[0]; } - return(&sin); + return(&s); } @@ -115,7 +115,7 @@ get_ip_addr(p) * char * pointer to a text-formatted string * */ -char * +const char * format_ip_addr(addr) struct in_addr *addr; { diff --git a/lib/libatm/libatm.h b/lib/libatm/libatm.h index 61dd6ccb3014..70142330c049 100644 --- a/lib/libatm/libatm.h +++ b/lib/libatm/libatm.h @@ -71,7 +71,7 @@ struct harp_timer { struct harp_timer *ht_next; /* Timer chain */ int ht_ticks; /* Seconds till exp */ int ht_mark; /* Processing flag */ - void (*ht_func)(); /* Function to call */ + void (*ht_func)(struct harp_timer *); /* Function to call */ }; typedef struct harp_timer Harp_timer; @@ -100,7 +100,7 @@ extern int get_netif_info(char *, struct air_netif_rsp **); /* ip_addr.c */ extern struct sockaddr_in *get_ip_addr(char *); -extern char *format_ip_addr(struct in_addr *); +extern const char *format_ip_addr(struct in_addr *); /* ip_checksum.c */ extern short ip_checksum(char *, int); @@ -108,9 +108,9 @@ extern short ip_checksum(char *, int); /* timer.c */ extern Harp_timer *harp_timer_head; extern int harp_timer_exec; -extern void timer_proc(); -extern int init_timer(); -extern int block_timer(); +extern void timer_proc(void); +extern int init_timer(void); +extern int block_timer(void); extern void enable_timer(int); diff --git a/lib/libatm/timer.c b/lib/libatm/timer.c index 898e2929a79e..1870e55c017b 100644 --- a/lib/libatm/timer.c +++ b/lib/libatm/timer.c @@ -72,7 +72,7 @@ int harp_timer_exec; * */ static void -timer_tick() +timer_tick(void) { /* * Bump the timer flag @@ -96,10 +96,10 @@ timer_tick() * */ void -timer_proc() +timer_proc(void) { Harp_timer *htp; - void (*f)(); + void (*f)(Harp_timer *); /* * Reset marks in all timers on the queue @@ -188,7 +188,7 @@ init_timer() /* * Set up signal handler */ - if (signal(SIGALRM, timer_tick) == SIG_ERR) { + if (signal(SIGALRM, (sig_t)timer_tick) == SIG_ERR) { return(errno); }