diff options
author | Amit Shah <amit.shah@redhat.com> | 2009-10-28 18:49:32 +0530 |
---|---|---|
committer | Amit Shah <amit.shah@redhat.com> | 2009-10-29 19:59:10 +0530 |
commit | 8d23286cd8293634d5aa578e8bfff46fee3c2977 (patch) | |
tree | c07bf294acc77e45920856f6ded75b84a25dec1f /auto-virtserial.c | |
parent | b848299eceb155dff6c5b847e9d81f5ba0453492 (diff) | |
download | test-virtserial-8d23286cd8293634d5aa578e8bfff46fee3c2977.tar.gz test-virtserial-8d23286cd8293634d5aa578e8bfff46fee3c2977.tar.xz test-virtserial-8d23286cd8293634d5aa578e8bfff46fee3c2977.zip |
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 <amit.shah@redhat.com>
Diffstat (limited to 'auto-virtserial.c')
-rw-r--r-- | auto-virtserial.c | 13 |
1 files changed, 7 insertions, 6 deletions
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); |