fix some warnings in tunproxy.c
authorGiuseppe Lettieri <g.lettieri@iet.unipi.it>
Thu, 4 Apr 2013 13:26:40 +0000 (15:26 +0200)
committerGiuseppe Lettieri <g.lettieri@iet.unipi.it>
Thu, 4 Apr 2013 13:26:40 +0000 (15:26 +0200)
planetlab/exp-tool/tunproxy.c

index 0f3ab81..024d886 100644 (file)
@@ -112,7 +112,7 @@ int main(int argc, char *argv[])
                if (select(fd+s+1, &fdset,NULL,NULL,NULL) < 0) PERROR("select");\r
                if (FD_ISSET(fd, &fdset)) {\r
                        if (DEBUG)\r
-                         write(1,">", 1);\r
+                         if (write(1,">", 1) < 0) PERROR("write");\r
                        l = read(fd, buf, sizeof(buf));\r
                        if (l < 0) \r
                          PERROR("read");\r
@@ -121,11 +121,11 @@ int main(int argc, char *argv[])
                }\r
                if (FD_ISSET(s, &fdset)) {\r
                        if (DEBUG) \r
-                         write(1,"<", 1);\r
+                         if (write(1,"<", 1) < 0) PERROR("write");\r
                        soutlen = sizeof(sout);\r
                        l = recvfrom(s, buf, sizeof(buf), 0, (struct sockaddr *)&sout, &soutlen);\r
                        if (l == -1) {\r
-                         write(1,"(", 1);\r
+                         if (write(1,"(", 1) < 0) PERROR("write");\r
                          fprintf(stderr, "[%s,%d]", strerror(errno), l);\r
                          continue;\r
                        }\r