Print this page
3910 t_look(3NSL) should never return T_ERROR

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libnsl/nsl/t_look.c
          +++ new/usr/src/lib/libnsl/nsl/t_look.c
↓ open down ↓ 18 lines elided ↑ open up ↑
  19   19   *
  20   20   * CDDL HEADER END
  21   21   */
  22   22  
  23   23  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  24   24  /*        All Rights Reserved   */
  25   25  
  26   26  /*
  27   27   * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  28   28   * Use is subject to license terms.
       29 + * Copyright 2014 Gary Mills
  29   30   */
  30   31  
  31      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  32      -
  33   32  #include "mt.h"
  34   33  #include <errno.h>
  35   34  #include <unistd.h>
  36   35  #include <sys/stream.h>
  37   36  #include <stropts.h>
  38   37  #define _SUN_TPI_VERSION 2
  39   38  #include <sys/tihdr.h>
  40   39  #include <sys/timod.h>
  41   40  #include <xti.h>
  42   41  #include <assert.h>
↓ open down ↓ 83 lines elided ↑ open up ↑
 126  125          strpeek.databuf.maxlen = 0;
 127  126          strpeek.databuf.len = 0;
 128  127          strpeek.databuf.buf = NULL;
 129  128          strpeek.flags = 0;
 130  129  
 131  130          do {
 132  131                  retval = ioctl(fd, I_PEEK, &strpeek);
 133  132          } while (retval < 0 && errno == EINTR);
 134  133  
 135  134          if (retval < 0) {
 136      -                if (_T_IS_TLI(api_semantics)) {
 137      -                        /*
 138      -                         * This return of T_ERROR event is ancient
 139      -                         * SVR3 TLI semantics and not documented for
 140      -                         * current SVR4 TLI interface.
 141      -                         * Fixing this will impact some apps
 142      -                         * (e.g. nfsd,lockd) in ON consolidation
 143      -                         * so they need to be fixed first before TLI
 144      -                         * can be fixed.
 145      -                         * XXX Should we never fix this because it might
 146      -                         * break apps in field ?
 147      -                         */
 148      -                        return (T_ERROR);
 149      -                }
 150  135                  /*
 151      -                 * XTI semantics (also identical to documented,
 152      -                 * but not implemented TLI semantics).
      136 +                 * XTI semantics (also identical to documented
      137 +                 * TLI semantics).
 153  138                   */
 154  139                  t_errno = TSYSERR;
 155  140                  return (-1);
 156  141          }
 157  142  
 158  143          /*
 159  144           * if something there and cntl part also there
 160  145           */
 161  146          if ((tiptr->ti_lookcnt > 0) ||
 162      -        ((retval > 0) && (strpeek.ctlbuf.len >= (int)sizeof (t_scalar_t)))) {
      147 +            ((retval > 0) && (strpeek.ctlbuf.len >=
      148 +            (int)sizeof (t_scalar_t)))) {
 163  149                  /* LINTED pointer cast */
 164  150                  pptr = (union T_primitives *)strpeek.ctlbuf.buf;
 165  151                  if (tiptr->ti_lookcnt > 0) {
 166  152                          /* LINTED pointer cast */
 167  153                          type = *((t_scalar_t *)tiptr->ti_lookbufs.tl_lookcbuf);
 168  154                          /*
 169  155                           * If message on stream head is a T_DISCON_IND, that
 170  156                           * has priority over a T_ORDREL_IND in the look
 171  157                           * buffer.
 172  158                           * (This assumes that T_ORDREL_IND can only be in the
↓ open down ↓ 93 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX