diff options
author | Christopher Faylor <me@cgf.cx> | 2002-05-12 01:50:38 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2002-05-12 01:50:38 +0000 |
commit | 6566d27da452d1f4a3397967c63aff7f6257fc9a (patch) | |
tree | 599ed32808df5f53b636f58e2f5ffaacc4ccf629 /winsup/cygwin/net.cc | |
parent | 0371d66a64f83c0bd34128ad4e4a5d9e0b74e884 (diff) | |
download | newlib-6566d27da452d1f4a3397967c63aff7f6257fc9a.zip newlib-6566d27da452d1f4a3397967c63aff7f6257fc9a.tar.gz newlib-6566d27da452d1f4a3397967c63aff7f6257fc9a.tar.bz2 |
fix formatting
Diffstat (limited to 'winsup/cygwin/net.cc')
-rw-r--r-- | winsup/cygwin/net.cc | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 357ddd5..c91f0af 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -2483,21 +2483,23 @@ cygwin_recvmsg(int s, struct msghdr *msg, int flags) for(i = 0; i < msg->msg_iovlen; ++i) tot += iov[i].iov_len; buf = (char *) malloc(tot); - if (tot != 0 && buf == NULL) { + if (tot != 0 && buf == NULL) + { errno = ENOMEM; return -1; - } + } nb = ret = cygwin_recvfrom (s, buf, tot, flags, (struct sockaddr *) msg->msg_name, (int *) &msg->msg_namelen); p = buf; - while (nb > 0) { + while (nb > 0) + { ssize_t cnt = min(nb, iov->iov_len); memcpy (iov->iov_base, p, cnt); p += cnt; nb -= cnt; ++iov; - } + } free(buf); return ret; } @@ -2515,15 +2517,17 @@ cygwin_sendmsg(int s, const struct msghdr *msg, int flags) for(i = 0; i < msg->msg_iovlen; ++i) tot += iov[i].iov_len; buf = (char *) malloc(tot); - if (tot != 0 && buf == NULL) { + if (tot != 0 && buf == NULL) + { errno = ENOMEM; return -1; - } + } p = buf; - for (i = 0; i < msg->msg_iovlen; ++i) { + for (i = 0; i < msg->msg_iovlen; ++i) + { memcpy (p, iov[i].iov_base, iov[i].iov_len); p += iov[i].iov_len; - } + } ret = cygwin_sendto (s, buf, tot, flags, (struct sockaddr *) msg->msg_name, msg->msg_namelen); free (buf); |