summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNils Ohlmeier [:drno] <drno@ohlmeier.org>2017-03-16 14:59:23 +0100
committerNils Ohlmeier [:drno] <drno@ohlmeier.org>2017-03-16 14:59:23 +0100
commite57d20e78a8e3cf88dc55a7655ee6fb230ec81e6 (patch)
tree8aeaf563ca6d586745d385246d1017b44926e910
parent90261f720963670641237ab4fe193d5b81a8897a (diff)
downloadnspr-hg-e57d20e78a8e3cf88dc55a7655ee6fb230ec81e6.tar.gz
Bug 1331810, enable sending of 0 size UDP packets in NSPR. r=ted
-rw-r--r--pr/src/io/prsocket.c4
-rw-r--r--pr/src/md/windows/w95sock.c5
2 files changed, 4 insertions, 5 deletions
diff --git a/pr/src/io/prsocket.c b/pr/src/io/prsocket.c
index be970240..f9dc939c 100644
--- a/pr/src/io/prsocket.c
+++ b/pr/src/io/prsocket.c
@@ -751,7 +751,7 @@ static PRInt32 PR_CALLBACK SocketSendTo(
#endif
count = 0;
- while (amount > 0) {
+ do {
temp = _PR_MD_SENDTO(fd, buf, amount, flags,
addrp, PR_NETADDR_SIZE(addr), timeout);
if (temp < 0) {
@@ -764,7 +764,7 @@ static PRInt32 PR_CALLBACK SocketSendTo(
}
buf = (const void*) ((const char*)buf + temp);
amount -= temp;
- }
+ } while (amount > 0);
return count;
}
diff --git a/pr/src/md/windows/w95sock.c b/pr/src/md/windows/w95sock.c
index 1c3ddd91..670e35da 100644
--- a/pr/src/md/windows/w95sock.c
+++ b/pr/src/md/windows/w95sock.c
@@ -294,8 +294,7 @@ _PR_MD_SENDTO(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags,
PRInt32 rv, err;
PRInt32 bytesSent = 0;
- while(bytesSent < amount)
- {
+ do {
while ((rv = sendto( osfd, buf, amount, 0, (struct sockaddr *) addr,
addrlen)) == -1)
{
@@ -327,7 +326,7 @@ _PR_MD_SENDTO(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags,
return -1;
}
}
- }
+ } while(bytesSent < amount);
return bytesSent;
}