Print this page


Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/zlogin/zlogin.c
          +++ new/usr/src/cmd/zlogin/zlogin.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  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   * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   * Copyright 2013 DEY Storage Systems, Inc.
  24   24   * Copyright (c) 2014 Gary Mills
  25      - * Copyright 2016 Joyent, Inc.
  26   25   * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
       26 + * Copyright 2016 Joyent, Inc.
  27   27   */
  28   28  
  29   29  /*
  30   30   * zlogin provides five types of login which allow users in the global
  31   31   * zone to access non-global zones.
  32   32   *
  33   33   * - "interactive login" is similar to rlogin(1); for example, the user could
  34   34   *   issue 'zlogin my-zone' or 'zlogin -e ^ -l me my-zone'.   The user is
  35   35   *   granted a new pty (which is then shoved into the zone), and an I/O
  36   36   *   loop between parent and child processes takes care of the interactive
↓ open down ↓ 241 lines elided ↑ open up ↑
 278  278          }
 279  279  
 280  280          bzero(&servaddr, sizeof (servaddr));
 281  281          servaddr.sun_family = AF_UNIX;
 282  282          (void) snprintf(servaddr.sun_path, sizeof (servaddr.sun_path),
 283  283              "%s/%s.%s", ZONES_TMPDIR, zname, suffix);
 284  284          if (connect(sockfd, (struct sockaddr *)&servaddr,
 285  285              sizeof (servaddr)) == -1) {
 286  286                  if (verbose)
 287  287                          zperror(gettext("Could not connect to zone"));
 288      -                close(sockfd);
      288 +                (void) close(sockfd);
 289  289                  return (-1);
 290  290          }
 291  291          return (sockfd);
 292  292  }
 293  293  
 294  294  
 295  295  static int
 296  296  handshake_zone_sock(int sockfd, unsigned int flags)
 297  297  {
 298  298          char clientid[MAXPATHLEN];
↓ open down ↓ 255 lines elided ↑ open up ↑
 554  554   */
 555  555  /*ARGSUSED*/
 556  556  static void
 557  557  sigwinch(int s)
 558  558  {
 559  559          struct winsize ws;
 560  560  
 561  561          if (ioctl(0, TIOCGWINSZ, &ws) == 0) {
 562  562                  if (ctlfd != -1) {
 563  563                          char buf[BUFSIZ];
 564      -                        snprintf(buf, sizeof (buf), "TIOCSWINSZ %hu %hu\n",
 565      -                            ws.ws_row, ws.ws_col);
      564 +                        (void) snprintf(buf, sizeof (buf),
      565 +                            "TIOCSWINSZ %hu %hu\n", ws.ws_row, ws.ws_col);
 566  566                          (void) send_ctl_sock(buf, strlen(buf));
 567  567                  } else {
 568  568                          (void) ioctl(masterfd, TIOCSWINSZ, &ws);
 569  569                  }
 570  570          }
 571  571  }
 572  572  
 573  573  /*
 574  574   * Toggle zfd EOF mode and notify zoneadmd
 575  575   */
 576  576  /*ARGSUSED*/
 577  577  static void
 578  578  sigusr1(int s)
 579  579  {
 580  580          connect_flags ^= ZLOGIN_ZFD_EOF;
 581  581          if (ctlfd != -1) {
 582  582                  char buf[BUFSIZ];
 583      -                snprintf(buf, sizeof (buf), "SETFLAGS %u\n",
      583 +                (void) snprintf(buf, sizeof (buf), "SETFLAGS %u\n",
 584  584                      connect_flags);
 585  585                  (void) send_ctl_sock(buf, strlen(buf));
 586  586          }
 587  587  }
 588  588  
 589  589  static volatile int close_on_sig = -1;
 590  590  
 591  591  static void
 592  592  /*ARGSUSED*/
 593  593  sigcld(int s)
↓ open down ↓ 1616 lines elided ↑ open up ↑
2210 2210                   *
2211 2211                   * Handshake with the control socket first. We handle retries
2212 2212                   * here since the relevant thread in zoneadmd might not have
2213 2213                   * finished setting up yet.
2214 2214                   */
2215 2215                  for (retry = 0; retry < MAX_RETRY; retry++) {
2216 2216                          masterfd = connect_zone_sock(zonename,
2217 2217                              (imode ? "server_ctl" : "console_sock"), B_FALSE);
2218 2218                          if (masterfd != -1)
2219 2219                                  break;
2220      -                        sleep(1);
     2220 +                        (void) sleep(1);
2221 2221                  }
2222 2222  
2223 2223                  if (retry == MAX_RETRY) {
2224 2224                          zerror(gettext("unable to connect for %d seconds"),
2225 2225                              MAX_RETRY);
2226 2226                          return (1);
2227 2227                  }
2228 2228  
2229 2229                  if (handshake_zone_sock(masterfd, connect_flags) != 0) {
2230 2230                          (void) close(masterfd);
↓ open down ↓ 399 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX