From 8d23286cd8293634d5aa578e8bfff46fee3c2977 Mon Sep 17 00:00:00 2001 From: Amit Shah Date: Wed, 28 Oct 2009 18:49:32 +0530 Subject: auto-test: Fix some warnings pointed out by clang 1. don't assign to 'ret' the o/p of fns that we don't intend to use later 2. Ensure 'ret' actually contains the value we want Signed-off-by: Amit Shah --- auto-virtserial.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'auto-virtserial.c') diff --git a/auto-virtserial.c b/auto-virtserial.c index 1dc008e..2ee9e57 100644 --- a/auto-virtserial.c +++ b/auto-virtserial.c @@ -620,11 +620,11 @@ static int test_guest_caching(int nr) if (ret == -1) error(errno, errno, "%s: write", __func__); - ret = guest_close_port(nr); + guest_close_port(nr); host_close_chardev(nr); free(buf); - ret = guest_open_port(nr); + guest_open_port(nr); ret = guest_read(nr, BUF_LENGTH); err = result(__func__, chardevs[nr].caching, "caching", ret, BUF_LENGTH, 0, OP_EQ, true); @@ -769,9 +769,10 @@ static int test_console(int nr) str = "find /\n"; write(chardevs[nr].sock, str, strlen(str)); - while (poll(pollfds, 1, 5000) == 1) { - read(chardevs[nr].sock, buf, 1024); - } + ret = 0; + while (poll(pollfds, 1, 5000) == 1) + ret = read(chardevs[nr].sock, buf, 1024); + /* Check if we're back to a prompt again */ str = strstr(buf, "~]$"); if (!str) { @@ -823,7 +824,7 @@ static int test_file_send(int nr) /* The guest now is waiting for our data */ while ((ret = read(fd, buf, BUF_LENGTH))) - ret = write(chardevs[nr].sock, buf, ret); + write(chardevs[nr].sock, buf, ret); /* guest will stop reading only if read() returns 0 */ host_close_chardev(nr); -- cgit