]> Zhao Yanbai Git Server - minix.git/commitdiff
INET: fix a few GCC compilation warnings
authorThomas Veerman <thomas@minix3.org>
Tue, 31 Jan 2012 15:43:00 +0000 (15:43 +0000)
committerThomas Veerman <thomas@minix3.org>
Wed, 1 Feb 2012 13:24:28 +0000 (13:24 +0000)
servers/inet/Makefile
servers/inet/generic/buf.h
servers/inet/generic/tcp_recv.c
servers/inet/generic/udp.c
servers/inet/inet_config.c
servers/inet/sr.c

index 8dbe78db811a6c3b2bdfc9fd4b7a216ae70bdc55..a0096328561d41752dd34bf94a98f8417e7f09e6 100644 (file)
@@ -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 <minix.service.mk>
index 95c89351080b2b8c2642d2a4420d93a971966f9c..8f508aad6c727d8c9223ab0deeea2d772ed909e9 100644 (file)
@@ -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), \
index b48a7de0bd2cc399731237f75113f229de6c5693..5264f7196e385a169d996df338631e2ef747c6be 100644 (file)
@@ -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));
index 99e8f99b53bcb28fc1bbfb66c999e9a7d9210cca..f173f4ed2f42bf6932c168948a9e60c6dac9e566 100644 (file)
@@ -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,
index 2a04540da3e209085eb0eebe094deaa35d037de1..c5ebd5d9b06adfb7316d3444544ad75e1cf7886c 100644 (file)
@@ -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;
index 7f1962983124d40b564ace90f47d1c25adf8b1c3..7965203994e8813d07797fafa014f30438abf366 100644 (file)
@@ -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)
        {