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
commit2c7a72073bf686e486da161ddbd8813131eec83c (patch)
tree2d7f458d97440f5fde8d9d55a32a3f94e86c36ed
parent4a3c1c16f5ebd5a41be6320a242255febeaf1a36 (diff)
downloadnspr-hg-2c7a72073bf686e486da161ddbd8813131eec83c.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;
}