Print this page
        
*** 20,31 ****
   */
  /*
   * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
   * Copyright 2013 DEY Storage Systems, Inc.
   * Copyright (c) 2014 Gary Mills
-  * Copyright 2016 Joyent, Inc.
   * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
   */
  
  /*
   * zlogin provides five types of login which allow users in the global
   * zone to access non-global zones.
--- 20,31 ----
   */
  /*
   * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
   * Copyright 2013 DEY Storage Systems, Inc.
   * Copyright (c) 2014 Gary Mills
   * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
+  * Copyright 2016 Joyent, Inc.
   */
  
  /*
   * zlogin provides five types of login which allow users in the global
   * zone to access non-global zones.
*** 283,293 ****
              "%s/%s.%s", ZONES_TMPDIR, zname, suffix);
          if (connect(sockfd, (struct sockaddr *)&servaddr,
              sizeof (servaddr)) == -1) {
                  if (verbose)
                          zperror(gettext("Could not connect to zone"));
!                 close(sockfd);
                  return (-1);
          }
          return (sockfd);
  }
  
--- 283,293 ----
              "%s/%s.%s", ZONES_TMPDIR, zname, suffix);
          if (connect(sockfd, (struct sockaddr *)&servaddr,
              sizeof (servaddr)) == -1) {
                  if (verbose)
                          zperror(gettext("Could not connect to zone"));
!                 (void) close(sockfd);
                  return (-1);
          }
          return (sockfd);
  }
  
*** 559,570 ****
          struct winsize ws;
  
          if (ioctl(0, TIOCGWINSZ, &ws) == 0) {
                  if (ctlfd != -1) {
                          char buf[BUFSIZ];
!                         snprintf(buf, sizeof (buf), "TIOCSWINSZ %hu %hu\n",
!                             ws.ws_row, ws.ws_col);
                          (void) send_ctl_sock(buf, strlen(buf));
                  } else {
                          (void) ioctl(masterfd, TIOCSWINSZ, &ws);
                  }
          }
--- 559,570 ----
          struct winsize ws;
  
          if (ioctl(0, TIOCGWINSZ, &ws) == 0) {
                  if (ctlfd != -1) {
                          char buf[BUFSIZ];
!                         (void) snprintf(buf, sizeof (buf),
!                             "TIOCSWINSZ %hu %hu\n", ws.ws_row, ws.ws_col);
                          (void) send_ctl_sock(buf, strlen(buf));
                  } else {
                          (void) ioctl(masterfd, TIOCSWINSZ, &ws);
                  }
          }
*** 578,588 ****
  sigusr1(int s)
  {
          connect_flags ^= ZLOGIN_ZFD_EOF;
          if (ctlfd != -1) {
                  char buf[BUFSIZ];
!                 snprintf(buf, sizeof (buf), "SETFLAGS %u\n",
                      connect_flags);
                  (void) send_ctl_sock(buf, strlen(buf));
          }
  }
  
--- 578,588 ----
  sigusr1(int s)
  {
          connect_flags ^= ZLOGIN_ZFD_EOF;
          if (ctlfd != -1) {
                  char buf[BUFSIZ];
!                 (void) snprintf(buf, sizeof (buf), "SETFLAGS %u\n",
                      connect_flags);
                  (void) send_ctl_sock(buf, strlen(buf));
          }
  }
  
*** 2215,2225 ****
                  for (retry = 0; retry < MAX_RETRY; retry++) {
                          masterfd = connect_zone_sock(zonename,
                              (imode ? "server_ctl" : "console_sock"), B_FALSE);
                          if (masterfd != -1)
                                  break;
!                         sleep(1);
                  }
  
                  if (retry == MAX_RETRY) {
                          zerror(gettext("unable to connect for %d seconds"),
                              MAX_RETRY);
--- 2215,2225 ----
                  for (retry = 0; retry < MAX_RETRY; retry++) {
                          masterfd = connect_zone_sock(zonename,
                              (imode ? "server_ctl" : "console_sock"), B_FALSE);
                          if (masterfd != -1)
                                  break;
!                         (void) sleep(1);
                  }
  
                  if (retry == MAX_RETRY) {
                          zerror(gettext("unable to connect for %d seconds"),
                              MAX_RETRY);