From: Thomas Veerman Date: Tue, 31 Jan 2012 15:43:00 +0000 (+0000) Subject: INET: fix a few GCC compilation warnings X-Git-Tag: v3.2.0~91 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/Bv9ARM.ch08.html?a=commitdiff_plain;h=224a0f6e909ac8ee4a64ed4d3f721c4b0c2e4e96;p=minix.git INET: fix a few GCC compilation warnings --- diff --git a/servers/inet/Makefile b/servers/inet/Makefile index 8dbe78db8..a00963285 100644 --- a/servers/inet/Makefile +++ b/servers/inet/Makefile @@ -15,10 +15,14 @@ SRCS= buf.c clock.c inet.c inet_config.c \ DPADD+= ${LIBCHARDRIVER} ${LIBSYS} ${LIBMINIXUTIL} LDADD+= -lchardriver -lsys -lminixutil +.if ${COMPILER_TYPE} == "gnu" +LDADD+= -lc +.endif + MAN= BINDIR?= /usr/sbin -CPPFLAGS+= -I${.CURDIR} -D_MINIX +CPPFLAGS+= -I${.CURDIR} -D_MINIX -Wall -Werror .include diff --git a/servers/inet/generic/buf.h b/servers/inet/generic/buf.h index 95c893510..8f508aad6 100644 --- a/servers/inet/generic/buf.h +++ b/servers/inet/generic/buf.h @@ -227,9 +227,8 @@ int bf_linkcheck ARGS(( acc_t *acc )); * the underlying buffer. */ -#define ptr2acc_data(/* acc_t * */ a) (bf_temporary_acc=(a), \ - (&bf_temporary_acc->acc_buffer->buf_data_p[bf_temporary_acc-> \ - acc_offset])) +#define ptr2acc_data(/* acc_t * */ a) (&((acc_t *)(a))->acc_buffer-> \ + buf_data_p[((acc_t *)(a))->acc_offset]) #define bf_chkbuf(buf) ((buf)? (compare((buf)->acc_linkC,>,0), \ compare((buf)->acc_buffer, !=, 0), \ diff --git a/servers/inet/generic/tcp_recv.c b/servers/inet/generic/tcp_recv.c index b48a7de0b..5264f7196 100644 --- a/servers/inet/generic/tcp_recv.c +++ b/servers/inet/generic/tcp_recv.c @@ -213,7 +213,7 @@ SYN-SENT: if (tcp_hdr_flags & THF_ACK) { if (tcp_LEmod4G(seg_ack, tcp_conn->tc_ISS) || - tcp_Gmod4G(seg_ack, tcp_conn->tc_SND_NXT)) + tcp_Gmod4G(seg_ack, tcp_conn->tc_SND_NXT)) { if (tcp_hdr_flags & THF_RST) break; else @@ -227,6 +227,7 @@ SYN-SENT: tcp_conn_write(tcp_conn, 1); break; } + } acceptable_ACK= (tcp_LEmod4G(tcp_conn->tc_SND_UNA, seg_ack) && tcp_LEmod4G(seg_ack, tcp_conn->tc_SND_NXT)); diff --git a/servers/inet/generic/udp.c b/servers/inet/generic/udp.c index 99e8f99b5..f173f4ed2 100644 --- a/servers/inet/generic/udp.c +++ b/servers/inet/generic/udp.c @@ -874,11 +874,12 @@ udp_fd_t *udp_fd; result= (*udp_fd->uf_put_userdata)(udp_fd->uf_srfd, (size_t)0, pack, FALSE); - if (result >= 0) + if (result >= 0) { if (size > transf_size) result= EPACKSIZE; else result= transf_size; + } udp_fd->uf_flags &= ~UFF_READ_IP; result= (*udp_fd->uf_put_userdata)(udp_fd->uf_srfd, result, diff --git a/servers/inet/inet_config.c b/servers/inet/inet_config.c index 2a04540da..c5ebd5d9b 100644 --- a/servers/inet/inet_config.c +++ b/servers/inet/inet_config.c @@ -247,7 +247,7 @@ static unsigned number(char *str, unsigned max) void read_conf(void) { - int i, j, ifno, type, port, enable; + int i, j, ifno = -1, type = -1, port = -1, enable; struct eth_conf *ecp; struct psip_conf *pcp; struct ip_conf *icp; @@ -304,8 +304,7 @@ void read_conf(void) } ecp++; eth_conf_nr++; - } else - if (strncmp(word, "psip", 4) == 0) { + } else if (strncmp(word, "psip", 4) == 0) { pcp->pc_ifno= ifno= number(word+4, IP_PORT_MAX-1); type= NETTYPE_PSIP; port= psip_conf_nr; @@ -315,6 +314,12 @@ void read_conf(void) printf("inet: Unknown device '%s'\n", word); error(); } + + if (type == -1 || ifno == -1 || port == -1) { + printf("inet: faulty configuration\n"); + exit(1); + } + iftype[ifno]= type; icp->ic_ifno= ifno; icp->ic_devtype= type; diff --git a/servers/inet/sr.c b/servers/inet/sr.c index 7f1962983..796520399 100644 --- a/servers/inet/sr.c +++ b/servers/inet/sr.c @@ -118,7 +118,7 @@ PUBLIC void sr_rec(m) mq_t *m; { int result; - int send_reply, free_mess; + int send_reply = 0, free_mess = 0; if (repl_queue) {