summary |
tags |
clone url |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
45264a4)
SCCS-vsn: lib/libc/net/res_send.c 6.12
*/
#if defined(LIBC_SCCS) && !defined(lint)
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)res_send.c 6.11 (Berkeley) %G%";
+static char sccsid[] = "@(#)res_send.c 6.12 (Berkeley) %G%";
#endif LIBC_SCCS and not lint
/*
#endif LIBC_SCCS and not lint
/*
#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <stdio.h>
#include <errno.h>
#include <netinet/in.h>
#include <stdio.h>
#include <errno.h>
struct timeval timeout;
HEADER *hp = (HEADER *) buf;
HEADER *anhp = (HEADER *) answer;
struct timeval timeout;
HEADER *hp = (HEADER *) buf;
HEADER *anhp = (HEADER *) answer;
#ifdef DEBUG
if (_res.options & RES_DEBUG) {
#ifdef DEBUG
if (_res.options & RES_DEBUG) {
* Send length & message
*/
len = htons((u_short)buflen);
* Send length & message
*/
len = htons((u_short)buflen);
- if (write(s, (char *)&len, sizeof(len)) != sizeof(len)||
- write(s, buf, buflen) != buflen) {
+ iov[0].iov_base = (caddr_t)&len;
+ iov[0].iov_len = sizeof(len);
+ iov[1].iov_base = buf;
+ iov[1].iov_len = buflen;
+ if (writev(s, iov, 2) != sizeof(len) + buflen) {
#ifdef DEBUG
if (_res.options & RES_DEBUG)
perror("write failed");
#ifdef DEBUG
if (_res.options & RES_DEBUG)
perror("write failed");
*/
cp = answer;
len = sizeof(short);
*/
cp = answer;
len = sizeof(short);
(n = read(s, (char *)cp, (int)len)) > 0) {
cp += n;
len -= n;
(n = read(s, (char *)cp, (int)len)) > 0) {
cp += n;
len -= n;
}
cp = answer;
resplen = len = ntohs(*(u_short *)cp);
}
cp = answer;
resplen = len = ntohs(*(u_short *)cp);
(n = read(s, (char *)cp, (int)len)) > 0) {
cp += n;
len -= n;
(n = read(s, (char *)cp, (int)len)) > 0) {
cp += n;
len -= n;
timeout.tv_usec = 0;
wait:
dsmask = 1 << s;
timeout.tv_usec = 0;
wait:
dsmask = 1 << s;
- n = select(s+1, &dsmask, 0, 0, &timeout);
+ n = select(s+1, &dsmask, (fd_set *)NULL,
+ (fd_set *)NULL, &timeout);
if (n < 0) {
#ifdef DEBUG
if (_res.options & RES_DEBUG)
if (n < 0) {
#ifdef DEBUG
if (_res.options & RES_DEBUG)