Commits

Ivan Vučica committed dc3d63e

Fixed an assortment of warnings under OS X.

Comments (0)

Files changed (2)

 tapper: $(TAPPER_OBJECTS)
 	$(CC) $(TAPPER_OBJECTS) -o tapper
 
-
+clean:
+	-rm $(TAPPER_OBJECTS) tapper
 #ifndef __APPLE__
 			enable_tuntap_headers = 1;
 #else
-			warnx("%s: no support for this option under OS X");
+			warnx("%s: no support for this option under OS X", argv[argoff]);
 #endif
 		else
 		if(!strcmp(argv[argoff], "--tapper-headers"))
 					/* yay! that one has something to say. let's read as much as
 					   possible for our buffer. num of actually read bytes is
 					   stored in ret, unless it's -1 which is error */
-					size_t ret = read(fd_int, buf, BUFFERSIZE);
+					ssize_t ret = read(fd_int, buf, BUFFERSIZE);
 					if (!ret) 
 					{
 						errx(100, "read(): nothing to read expecting data");
 						memcpy(with_headers + sizeof(size), buf, ret);
 						if(write(fd_oth, with_headers, sizeof(size) + ret)<0)
 							err(ERR_WRITE_ERR, "write(%d)", fd_oth);
-						DEBUG("wrote %d bytes", sizeof(size) + ret);
+						DEBUG("wrote %lu bytes", sizeof(size) + ret);
 						free(with_headers);
 					}
 					else
 					static size_t current_buffer_content_size = 0;
 					if(!expected_size)
 					{
-						int ret = read(fd_int, &expected_size, sizeof(uint16_t));
+						ssize_t ret = read(fd_int, &expected_size, sizeof(uint16_t));
 						if(!ret)
 						{
 							errx(101, "read(): nothing to read expecting message size");
 					else
 					{
 						size_t bytes_left = expected_size - current_buffer_content_size;
-						int ret = read(fd_int, buf + current_buffer_content_size, bytes_left);
+						ssize_t ret = read(fd_int, buf + current_buffer_content_size, bytes_left);
 						if(!ret)
 						{
 							errx(102, "read(): nothing to read expecting buffer content");
 						if (ret < 0) err(ERR_READ_ERR, "read(%d) for buffer content", fd_int);
 
 						current_buffer_content_size += ret;
-						DEBUG("received %d bytes; buffer now %d/%d", ret, current_buffer_content_size, expected_size);
+						DEBUG("received %lu bytes; buffer now %lu/%hu", ret, current_buffer_content_size, expected_size);
 						
 						if(current_buffer_content_size == expected_size)
 						{