Skip to content

Commit 824c743

Browse files
committed
use size_t for the total byte count
1 parent 95bbf7f commit 824c743

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

select/write-select.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ main(int argc, char **argv)
4848
fd_set wrfds;
4949
char buf[BUF_LEN];
5050
struct sockaddr_in sa;
51-
int s, newsock, n, total = 0, optval = 1;
51+
int s, newsock, n, optval = 1;
52+
size_t total = 0;
5253

5354
if (argc != 2)
5455
errx(1, "usage: %s <port>", basename(argv[0]));
@@ -104,7 +105,7 @@ main(int argc, char **argv)
104105
if ((n = write(newsock, buf, sizeof (buf))) == -1)
105106
err(1, "write");
106107
total = total + n;
107-
fprintf(stderr, "[ %d bytes written (total %d) ]\n",
108+
fprintf(stderr, "[ %d bytes written (total %zu) ]\n",
108109
n, total);
109110
}
110111

0 commit comments

Comments
 (0)