fix formatting

This commit is contained in:
Christopher Faylor 2002-05-12 01:50:38 +00:00
parent 0371d66a64
commit 6566d27da4
2 changed files with 17 additions and 12 deletions

View File

@ -2483,21 +2483,23 @@ cygwin_recvmsg(int s, struct msghdr *msg, int flags)
for(i = 0; i < msg->msg_iovlen; ++i) for(i = 0; i < msg->msg_iovlen; ++i)
tot += iov[i].iov_len; tot += iov[i].iov_len;
buf = (char *) malloc(tot); buf = (char *) malloc(tot);
if (tot != 0 && buf == NULL) { if (tot != 0 && buf == NULL)
{
errno = ENOMEM; errno = ENOMEM;
return -1; return -1;
} }
nb = ret = cygwin_recvfrom (s, buf, tot, flags, nb = ret = cygwin_recvfrom (s, buf, tot, flags,
(struct sockaddr *) msg->msg_name, (int *) &msg->msg_namelen); (struct sockaddr *) msg->msg_name, (int *) &msg->msg_namelen);
p = buf; p = buf;
while (nb > 0) { while (nb > 0)
{
ssize_t cnt = min(nb, iov->iov_len); ssize_t cnt = min(nb, iov->iov_len);
memcpy (iov->iov_base, p, cnt); memcpy (iov->iov_base, p, cnt);
p += cnt; p += cnt;
nb -= cnt; nb -= cnt;
++iov; ++iov;
} }
free(buf); free(buf);
return ret; return ret;
} }
@ -2515,15 +2517,17 @@ cygwin_sendmsg(int s, const struct msghdr *msg, int flags)
for(i = 0; i < msg->msg_iovlen; ++i) for(i = 0; i < msg->msg_iovlen; ++i)
tot += iov[i].iov_len; tot += iov[i].iov_len;
buf = (char *) malloc(tot); buf = (char *) malloc(tot);
if (tot != 0 && buf == NULL) { if (tot != 0 && buf == NULL)
{
errno = ENOMEM; errno = ENOMEM;
return -1; return -1;
} }
p = buf; 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); memcpy (p, iov[i].iov_base, iov[i].iov_len);
p += iov[i].iov_len; p += iov[i].iov_len;
} }
ret = cygwin_sendto (s, buf, tot, flags, ret = cygwin_sendto (s, buf, tot, flags,
(struct sockaddr *) msg->msg_name, msg->msg_namelen); (struct sockaddr *) msg->msg_name, msg->msg_namelen);
free (buf); free (buf);

View File

@ -165,10 +165,11 @@ gettimeofday(struct timeval *tv, struct timezone *tz)
if (tz != NULL) if (tz != NULL)
{ {
if (!tzflag) { if (!tzflag)
tzset(); {
tzflag = true; tzset();
} tzflag = true;
}
tz->tz_minuteswest = _timezone / 60; tz->tz_minuteswest = _timezone / 60;
tz->tz_dsttime = _daylight; tz->tz_dsttime = _daylight;
} }