stress2: Fix "set-but-not-unused" warnings

This commit is contained in:
Peter Holm 2021-12-25 07:27:25 +00:00
parent 4bae154fe8
commit 9a6201ac2f
2 changed files with 2 additions and 6 deletions

View file

@ -47,15 +47,13 @@ static int sv[2];
static void
reader(void) {
int n, t, *buf;
int n, *buf;
t = 0;
if ((buf = malloc(bufsize)) == NULL)
err(1, "malloc(%d), %s:%d", bufsize, __FILE__, __LINE__);
while (done_testing == 0) {
if ((n = read(sv[0], buf, bufsize)) < 0)
err(1, "read(), %s:%d", __FILE__, __LINE__);
t += n;
if (n == 0) break;
}
close(sv[0]);

View file

@ -52,7 +52,7 @@ reader(void) {
struct sockaddr_in inetaddr, inetpeer;
socklen_t len;
int on;
int n, t, *buf;
int n, *buf;
int tcpsock, msgsock;
alarm(op->run_time + 30);
@ -85,13 +85,11 @@ reader(void) {
(struct sockaddr *)&inetpeer, &len)) < 0)
err(1, "accept(), %s:%d", __FILE__, __LINE__);
t = 0;
if ((buf = malloc(bufsize)) == NULL)
err(1, "malloc(%d), %s:%d", bufsize, __FILE__, __LINE__);
while (done_testing == 0) {
if ((n = read(msgsock, buf, bufsize)) < 0)
err(1, "read(), %s:%d", __FILE__, __LINE__);
t += n;
if (n == 0) break;
}
close(msgsock);