[BACK]Return to res_send.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libc / resolv

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/lib/libc/resolv/res_send.c between version 1.15 and 1.15.12.1

version 1.15, 2008/06/21 23:37:53 version 1.15.12.1, 2011/01/09 20:43:29
Line 1 
Line 1 
 /*      $NetBSD$        */  /*      $NetBSD$        */
   
 /*  /*
    * Portions Copyright (C) 2004-2009  Internet Systems Consortium, Inc. ("ISC")
    * Portions Copyright (C) 1996-2003  Internet Software Consortium.
    *
    * Permission to use, copy, modify, and/or distribute this software for any
    * purpose with or without fee is hereby granted, provided that the above
    * copyright notice and this permission notice appear in all copies.
    *
    * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
    * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
    * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
    * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
    * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
    * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
    * PERFORMANCE OF THIS SOFTWARE.
    */
   
   /*
  * Copyright (c) 1985, 1989, 1993   * Copyright (c) 1985, 1989, 1993
  *    The Regents of the University of California.  All rights reserved.   *    The Regents of the University of California.  All rights reserved.
  *   *
  * Redistribution and use in source and binary forms, with or without   * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions   * modification, are permitted provided that the following conditions
  * are met:   * are met:
Line 19 
Line 36 
  * 4. Neither the name of the University nor the names of its contributors   * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software   *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.   *    without specific prior written permission.
  *   *
  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND   * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE   * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Line 35 
Line 52 
   
 /*  /*
  * Portions Copyright (c) 1993 by Digital Equipment Corporation.   * Portions Copyright (c) 1993 by Digital Equipment Corporation.
  *   *
  * Permission to use, copy, modify, and distribute this software for any   * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above   * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies, and that   * copyright notice and this permission notice appear in all copies, and that
  * the name of Digital Equipment Corporation not be used in advertising or   * the name of Digital Equipment Corporation not be used in advertising or
  * publicity pertaining to distribution of the document or software without   * publicity pertaining to distribution of the document or software without
  * specific, written prior permission.   * specific, written prior permission.
  *   *
  * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL   * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
  * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES   * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
  * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT   * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
Line 74 
Line 91 
 #if defined(LIBC_SCCS) && !defined(lint)  #if defined(LIBC_SCCS) && !defined(lint)
 #ifdef notdef  #ifdef notdef
 static const char sccsid[] = "@(#)res_send.c    8.1 (Berkeley) 6/4/93";  static const char sccsid[] = "@(#)res_send.c    8.1 (Berkeley) 6/4/93";
 static const char rcsid[] = "Id: res_send.c,v 1.18.10.1 2008/01/27 02:06:46 marka Exp";  static const char rcsid[] = "Id: res_send.c,v 1.22 2009/01/22 23:49:23 tbox Exp";
 #else  #else
 __RCSID("$NetBSD$");  __RCSID("$NetBSD$");
 #endif  #endif
Line 320  res_nsend(res_state statp,
Line 337  res_nsend(res_state statp,
         highestFD = sysconf(_SC_OPEN_MAX) - 1;          highestFD = sysconf(_SC_OPEN_MAX) - 1;
 #endif  #endif
   
           (void)res_check(statp, NULL);
   
         /* No name servers or res_init() failure */          /* No name servers or res_init() failure */
         if (statp->nscount == 0 || EXT(statp).ext == NULL) {          if (statp->nscount == 0 || EXT(statp).ext == NULL) {
                 errno = ESRCH;                  errno = ESRCH;
Line 358  res_nsend(res_state statp,
Line 377  res_nsend(res_state statp,
                                 if (EXT(statp).nssocks[ns] == -1)                                  if (EXT(statp).nssocks[ns] == -1)
                                         continue;                                          continue;
                                 peerlen = sizeof(peer);                                  peerlen = sizeof(peer);
                                 if (getsockname(EXT(statp).nssocks[ns],                                  if (getpeername(EXT(statp).nssocks[ns],
                                     (struct sockaddr *)(void *)&peer, &peerlen) < 0) {                                      (struct sockaddr *)(void *)&peer, &peerlen) < 0) {
                                         needclose++;                                          needclose++;
                                         break;                                          break;
Line 409  res_nsend(res_state statp,
Line 428  res_nsend(res_state statp,
                 nstime = EXT(statp).nstimes[0];                  nstime = EXT(statp).nstimes[0];
                 for (ns = 0; ns < lastns; ns++) {                  for (ns = 0; ns < lastns; ns++) {
                         if (EXT(statp).ext != NULL)                          if (EXT(statp).ext != NULL)
                                 EXT(statp).ext->nsaddrs[ns] =                                  EXT(statp).ext->nsaddrs[ns] =
                                         EXT(statp).ext->nsaddrs[ns + 1];                                          EXT(statp).ext->nsaddrs[ns + 1];
                         statp->nsaddr_list[ns] = statp->nsaddr_list[ns + 1];                          statp->nsaddr_list[ns] = statp->nsaddr_list[ns + 1];
                         EXT(statp).nssocks[ns] = EXT(statp).nssocks[ns + 1];                          EXT(statp).nssocks[ns] = EXT(statp).nssocks[ns + 1];
Line 673  send_vc(res_state statp,
Line 692  send_vc(res_state statp,
                 /*                  /*
                  * Disable generation of SIGPIPE when writing to a closed                   * Disable generation of SIGPIPE when writing to a closed
                  * socket.  Write should return -1 and set errno to EPIPE                   * socket.  Write should return -1 and set errno to EPIPE
                  * instead.                   * instead.
                  *                   *
                  * Push on even if setsockopt(SO_NOSIGPIPE) fails.                   * Push on even if setsockopt(SO_NOSIGPIPE) fails.
                  */                   */
                 (void)setsockopt(statp->_vcsock, SOL_SOCKET, SO_NOSIGPIPE, &on,                  (void)setsockopt(statp->_vcsock, SOL_SOCKET, SO_NOSIGPIPE, &on,
                                  sizeof(on));                                   sizeof(on));
 #endif  #endif
                 errno = 0;                  errno = 0;
                 if (connect(statp->_vcsock, nsap, (socklen_t)nsaplen) < 0) {                  if (connect(statp->_vcsock, nsap, (socklen_t)nsaplen) < 0) {
Line 913  send_dg(res_state statp, const u_char *b
Line 932  send_dg(res_state statp, const u_char *b
         timeout = evSubTime(finish, now);          timeout = evSubTime(finish, now);
         if (timeout.tv_sec < 0)          if (timeout.tv_sec < 0)
                 timeout = evConsTime(0L, 0L);                  timeout = evConsTime(0L, 0L);
         polltimeout = 1000*timeout.tv_sec +          polltimeout = 1000*(int)timeout.tv_sec +
                 timeout.tv_nsec/1000000;                  (int)timeout.tv_nsec/1000000;
         pollfd.fd = s;          pollfd.fd = s;
         pollfd.events = POLLRDNORM;          pollfd.events = POLLRDNORM;
         n = poll(&pollfd, 1, polltimeout);          n = poll(&pollfd, 1, polltimeout);

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.15.12.1

CVSweb <webmaster@jp.NetBSD.org>