git: 9a6201ac2ff2 - main - stress2: Fix "set-but-not-unused" warnings
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 25 Dec 2021 07:28:04 UTC
The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=9a6201ac2ff2e6a15816c7d6efbccaa803eb122b commit 9a6201ac2ff2e6a15816c7d6efbccaa803eb122b Author: Peter Holm <pho@FreeBSD.org> AuthorDate: 2021-12-25 07:27:25 +0000 Commit: Peter Holm <pho@FreeBSD.org> CommitDate: 2021-12-25 07:27:25 +0000 stress2: Fix "set-but-not-unused" warnings --- tools/test/stress2/testcases/socket/socket.c | 4 +--- tools/test/stress2/testcases/tcp/tcp.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/tools/test/stress2/testcases/socket/socket.c b/tools/test/stress2/testcases/socket/socket.c index 965ce6b852c3..ec9b1e6cd28f 100644 --- a/tools/test/stress2/testcases/socket/socket.c +++ b/tools/test/stress2/testcases/socket/socket.c @@ -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]); diff --git a/tools/test/stress2/testcases/tcp/tcp.c b/tools/test/stress2/testcases/tcp/tcp.c index 5d8d7197b5be..468acb169f4a 100644 --- a/tools/test/stress2/testcases/tcp/tcp.c +++ b/tools/test/stress2/testcases/tcp/tcp.c @@ -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);