Print this page
1926 libresolv evades compiler warnings

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libresolv/res_send.c
          +++ new/usr/src/lib/libresolv/res_send.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
       23 + * Copyright 2015 Gary Mills
  23   24   * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  24   25   * Use is subject to license terms.
  25   26   */
  26   27  
  27   28  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  28   29  /*        All Rights Reserved   */
  29   30  
  30   31  /*
  31   32   * University Copyright- Copyright (c) 1982, 1986, 1988
  32   33   * The Regents of the University of California
  33   34   * All Rights Reserved
  34   35   *
  35   36   * University Acknowledgment- Portions of this document are derived from
  36   37   * software developed by the University of California, Berkeley, and its
  37   38   * contributors.
  38   39   */
  39   40  
  40      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  41      -
  42   41  /*
  43   42   * Send query to name server and wait for reply.
  44   43   */
  45   44  
  46   45  #include <sys/param.h>
  47   46  #include <sys/time.h>
  48   47  #include <sys/socket.h>
  49   48  #include <sys/uio.h>
  50   49  #include <sys/stat.h>
  51   50  #include <netinet/in.h>
  52   51  #include <stdio.h>
       52 +#include <string.h>
       53 +#include <unistd.h>
  53   54  #include <errno.h>
  54   55  #include <arpa/nameser.h>
       56 +#include <arpa/inet.h>
  55   57  #include <resolv.h>
       58 +#include "crossl.h"
  56   59  
       60 +/*
       61 + * Undocumented external function in libsocket
       62 + */
       63 +extern int
       64 +_socket(int, int, int);
  57   65  
  58   66  static int s = -1;      /* socket used for communications */
       67 +#if     BSD >= 43
  59   68  static struct sockaddr no_addr;
       69 +#endif /* BSD */
  60   70  
  61   71  
  62   72  #ifndef FD_SET
  63   73  #define NFDBITS         32
  64   74  #define FD_SETSIZE      32
  65   75  #define FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
  66   76  #define FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
  67   77  #define FD_ISSET(n, p)  ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
  68   78  #ifdef SYSV
  69      -#define FD_ZERO(p)      memset((void *)(p), 0, sizeof (*(p)))
       79 +#define FD_ZERO(p)      (void) memset((void *)(p), 0, sizeof (*(p)))
  70   80  #else
  71   81  #define FD_ZERO(p)      bzero((char *)(p), sizeof (*(p)))
  72   82  #endif
  73   83  #endif
  74   84  
  75   85  /*
  76   86   * 1247019: Kludge to time out quickly if there is no /etc/resolv.conf
  77   87   * and a TCP connection to the local DNS server fails.
  78   88   */
  79   89  
↓ open down ↓ 42 lines elided ↑ open up ↑
 122  132  
 123  133  int
 124  134  res_send(buf, buflen, answer, anslen)
 125  135          char *buf;
 126  136          int buflen;
 127  137          char *answer;
 128  138          int anslen;
 129  139  {
 130  140          register int n;
 131  141          int try, v_circuit, resplen, ns;
 132      -        int gotsomewhere = 0, connected = 0;
      142 +        int gotsomewhere = 0;
      143 +#if     BSD >= 43
      144 +        int connected = 0;
      145 +#endif /* BSD */
 133  146          int connreset = 0;
 134  147          u_short id, len;
 135  148          char *cp;
 136  149          fd_set dsmask;
 137  150          struct timeval timeout;
 138  151          HEADER *hp = (HEADER *) buf;
 139  152          HEADER *anhp = (HEADER *) answer;
 140  153          struct iovec iov[2];
 141  154          int terrno = ETIMEDOUT;
 142  155          char junk[512];
↓ open down ↓ 374 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX