* [Qemu-devel] [PATCH] iov: Fix do_send_recv() for MinGW (also fixes a build breakage)
@ 2012-07-11 5:09 Stefan Weil
2012-07-11 5:25 ` Michael Tokarev
0 siblings, 1 reply; 5+ messages in thread
From: Stefan Weil @ 2012-07-11 5:09 UTC (permalink / raw)
To: Anthony Liguori; +Cc: Stefan Weil, Michael Tokarev, qemu-devel
Commit 25e5e4c7 broke compilation for non POSIX hosts (e.g. MinGW)
because it partially replaced "ret" by "count".
It also changed the handling of EINTR in a wrong way.
The patch restores the old code for these two changes.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
iov.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/iov.c b/iov.c
index 7cc08f0..b333061 100644
--- a/iov.c
+++ b/iov.c
@@ -114,9 +114,9 @@ do_send_recv(int sockfd, struct iovec *iov, unsigned iov_cnt, bool do_send)
#else
/* else send piece-by-piece */
/*XXX Note: windows has WSASend() and WSARecv() */
- unsigned i;
- size_t count = 0;
- for (i = 0; i < iov_cnt; ++i) {
+ unsigned i = 0;
+ ssize_t ret = 0;
+ while (i < iov_cnt) {
ssize_t r = do_send
? send(sockfd, iov[i].iov_base, iov[i].iov_len, 0)
: recv(sockfd, iov[i].iov_base, iov[i].iov_len, 0);
@@ -130,12 +130,13 @@ do_send_recv(int sockfd, struct iovec *iov, unsigned iov_cnt, bool do_send)
/* else it is some "other" error,
* only return if there was no data processed. */
if (ret == 0) {
- return -1;
+ ret = -1;
}
break;
}
+ i++;
}
- return count;
+ return ret;
#endif
}
--
1.7.10
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] iov: Fix do_send_recv() for MinGW (also fixes a build breakage)
2012-07-11 5:09 [Qemu-devel] [PATCH] iov: Fix do_send_recv() for MinGW (also fixes a build breakage) Stefan Weil
@ 2012-07-11 5:25 ` Michael Tokarev
2012-07-11 12:39 ` Kevin Wolf
0 siblings, 1 reply; 5+ messages in thread
From: Michael Tokarev @ 2012-07-11 5:25 UTC (permalink / raw)
To: Stefan Weil; +Cc: Anthony Liguori, qemu-devel
On 11.07.2012 09:09, Stefan Weil wrote:
> Commit 25e5e4c7 broke compilation for non POSIX hosts (e.g. MinGW)
> because it partially replaced "ret" by "count".
>
> It also changed the handling of EINTR in a wrong way.
>
> The patch restores the old code for these two changes.
>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Granted, I never _ever_ tested or even compiled this
part. Should have been. Thank you Stefan!
/mjt
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] iov: Fix do_send_recv() for MinGW (also fixes a build breakage)
2012-07-11 5:25 ` Michael Tokarev
@ 2012-07-11 12:39 ` Kevin Wolf
2012-07-11 13:15 ` Paolo Bonzini
0 siblings, 1 reply; 5+ messages in thread
From: Kevin Wolf @ 2012-07-11 12:39 UTC (permalink / raw)
To: Michael Tokarev; +Cc: Stefan Weil, Anthony Liguori, qemu-devel
Am 11.07.2012 07:25, schrieb Michael Tokarev:
> On 11.07.2012 09:09, Stefan Weil wrote:
>> Commit 25e5e4c7 broke compilation for non POSIX hosts (e.g. MinGW)
>> because it partially replaced "ret" by "count".
>>
>> It also changed the handling of EINTR in a wrong way.
>>
>> The patch restores the old code for these two changes.
>>
>> Signed-off-by: Stefan Weil <sw@weilnetz.de>
>
> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
>
> Granted, I never _ever_ tested or even compiled this
> part. Should have been. Thank you Stefan!
Then I guess you should not have sent a pull request. :-)
Kevin
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] iov: Fix do_send_recv() for MinGW (also fixes a build breakage)
2012-07-11 12:39 ` Kevin Wolf
@ 2012-07-11 13:15 ` Paolo Bonzini
2012-07-11 13:50 ` Anthony Liguori
0 siblings, 1 reply; 5+ messages in thread
From: Paolo Bonzini @ 2012-07-11 13:15 UTC (permalink / raw)
To: Kevin Wolf; +Cc: Stefan Weil, Anthony Liguori, Michael Tokarev, qemu-devel
Il 11/07/2012 14:39, Kevin Wolf ha scritto:
> Am 11.07.2012 07:25, schrieb Michael Tokarev:
>> On 11.07.2012 09:09, Stefan Weil wrote:
>>> Commit 25e5e4c7 broke compilation for non POSIX hosts (e.g. MinGW)
>>> because it partially replaced "ret" by "count".
>>>
>>> It also changed the handling of EINTR in a wrong way.
>>>
>>> The patch restores the old code for these two changes.
>>>
>>> Signed-off-by: Stefan Weil <sw@weilnetz.de>
>>
>> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
>>
>> Granted, I never _ever_ tested or even compiled this
>> part. Should have been. Thank you Stefan!
>
> Then I guess you should not have sent a pull request. :-)
Not that Anthony would have tested mingw...
Paolo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] iov: Fix do_send_recv() for MinGW (also fixes a build breakage)
2012-07-11 13:15 ` Paolo Bonzini
@ 2012-07-11 13:50 ` Anthony Liguori
0 siblings, 0 replies; 5+ messages in thread
From: Anthony Liguori @ 2012-07-11 13:50 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: Kevin Wolf, Stefan Weil, Michael Tokarev, qemu-devel
On 07/11/2012 08:15 AM, Paolo Bonzini wrote:
> Il 11/07/2012 14:39, Kevin Wolf ha scritto:
>> Am 11.07.2012 07:25, schrieb Michael Tokarev:
>>> On 11.07.2012 09:09, Stefan Weil wrote:
>>>> Commit 25e5e4c7 broke compilation for non POSIX hosts (e.g. MinGW)
>>>> because it partially replaced "ret" by "count".
>>>>
>>>> It also changed the handling of EINTR in a wrong way.
>>>>
>>>> The patch restores the old code for these two changes.
>>>>
>>>> Signed-off-by: Stefan Weil<sw@weilnetz.de>
>>>
>>> Signed-off-by: Michael Tokarev<mjt@tls.msk.ru>
>>>
>>> Granted, I never _ever_ tested or even compiled this
>>> part. Should have been. Thank you Stefan!
>>
>> Then I guess you should not have sent a pull request. :-)
>
> Not that Anthony would have tested mingw...
Nope. It's not efficient to rely on the maintainer to do your testing for you.
If you modify code in a non-trivial way, you should attempt to test it.
Anyway, I'll apply this patch ASAP.
Regards,
Anthony Liguori
>
> Paolo
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-07-11 13:53 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-11 5:09 [Qemu-devel] [PATCH] iov: Fix do_send_recv() for MinGW (also fixes a build breakage) Stefan Weil
2012-07-11 5:25 ` Michael Tokarev
2012-07-11 12:39 ` Kevin Wolf
2012-07-11 13:15 ` Paolo Bonzini
2012-07-11 13:50 ` Anthony Liguori
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.