Print this page
2989 Eliminate use of LOGNAME_MAX in ON
1166 useradd have warning with name more 8 chars

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/init/init.c
          +++ new/usr/src/cmd/init/init.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 (c) 2013 Gary Mills
       24 + *
  23   25   * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
  24   26   */
  25   27  
  26   28  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  27   29  /*        All Rights Reserved   */
  28   30  
  29   31  /*
  30   32   * University Copyright- Copyright (c) 1982, 1986, 1988
  31   33   * The Regents of the University of California
  32   34   * All Rights Reserved
↓ open down ↓ 99 lines elided ↑ open up ↑
 132  134  
 133  135  #undef  sleep
 134  136  
 135  137  #define fioctl(p, sptr, cmd)    ioctl(fileno(p), sptr, cmd)
 136  138  #define min(a, b)               (((a) < (b)) ? (a) : (b))
 137  139  
 138  140  #define TRUE    1
 139  141  #define FALSE   0
 140  142  #define FAILURE -1
 141  143  
      144 +#define UT_USER_SZ      32      /* Size of a utmpx ut_user field */
 142  145  #define UT_LINE_SZ      32      /* Size of a utmpx ut_line field */
 143  146  
 144  147  /*
 145  148   * SLEEPTIME    The number of seconds "init" sleeps between wakeups if
 146  149   *              nothing else requires this "init" wakeup.
 147  150   */
 148  151  #define SLEEPTIME       (5 * 60)
 149  152  
 150  153  /*
 151  154   * MAXCMDL      The maximum length of a command string in inittab.
↓ open down ↓ 1444 lines elided ↑ open up ↑
1596 1599                  if ((c = fgetc(fp_inittab)) == EOF) {
1597 1600                          answer = FALSE;
1598 1601                          (void) fclose(fp_inittab);
1599 1602                          fp_inittab = NULL;
1600 1603                          break;
1601 1604                  }
1602 1605  
1603 1606                  for (proceed = TRUE, ptr = shcmd, state = ID, lastc = '\0';
1604 1607                      proceed && c != EOF;
1605 1608                      lastc = c, c = fgetc(fp_inittab)) {
1606      -                    /* If we're not in the FAILURE state and haven't    */
1607      -                    /* yet reached the shell command field, process     */
1608      -                    /* the line, otherwise just look for a real end     */
1609      -                    /* of line.                                         */
1610      -                    if (state != FAILURE && state != COMMAND) {
     1609 +                        /* If we're not in the FAILURE state and haven't */
     1610 +                        /* yet reached the shell command field, process  */
     1611 +                        /* the line, otherwise just look for a real end  */
     1612 +                        /* of line.                                      */
     1613 +                        if (state != FAILURE && state != COMMAND) {
1611 1614                          /*
1612 1615                           * Squeeze out spaces and tabs.
1613 1616                           */
1614 1617                          if (c == ' ' || c == '\t')
1615 1618                                  continue;
1616 1619  
1617 1620                          /*
1618 1621                           * Ignore characters in a comment, except for the \n.
1619 1622                           */
1620 1623                          if (state == COMMENT) {
↓ open down ↓ 15 lines elided ↑ open up ↑
1636 1639                                  state = COMMENT;
1637 1640                                  continue;
1638 1641                          }
1639 1642  
1640 1643                          /*
1641 1644                           * If the character is a ':', then check the
1642 1645                           * previous field for correctness and advance
1643 1646                           * to the next field.
1644 1647                           */
1645 1648                          if (c == ':') {
1646      -                            switch (state) {
     1649 +                                switch (state) {
1647 1650  
1648      -                            case ID :
     1651 +                                case ID :
1649 1652                                  /*
1650 1653                                   * Check to see that there are only
1651 1654                                   * 1 to 4 characters for the id.
1652 1655                                   */
1653 1656                                  if ((i = ptr - shcmd) < 1 || i > 4) {
1654 1657                                          state = FAILURE;
1655 1658                                  } else {
1656 1659                                          bcopy(shcmd, &cmd->c_id[0], i);
1657 1660                                          ptr = shcmd;
1658 1661                                          state = LEVELS;
1659 1662                                  }
1660 1663                                  break;
1661 1664  
1662      -                            case LEVELS :
     1665 +                                case LEVELS :
1663 1666                                  /*
1664 1667                                   * Build a mask for all the levels for
1665 1668                                   * which this command will be legal.
1666 1669                                   */
1667 1670                                  for (cmd->c_levels = 0, ptr1 = shcmd;
1668 1671                                      ptr1 < ptr; ptr1++) {
1669 1672                                          int mask;
1670 1673                                          if (lvlname_to_mask(*ptr1,
1671 1674                                              &mask) == -1) {
1672 1675                                                  state = FAILURE;
1673 1676                                                  break;
1674 1677                                          }
1675 1678                                          cmd->c_levels |= mask;
1676 1679                                  }
1677 1680                                  if (state != FAILURE) {
1678 1681                                          state = ACTION;
1679 1682                                          ptr = shcmd;    /* Reset the buffer */
1680 1683                                  }
1681 1684                                  break;
1682 1685  
1683      -                            case ACTION :
     1686 +                                case ACTION :
1684 1687                                  /*
1685 1688                                   * Null terminate the string in shcmd buffer and
1686 1689                                   * then try to match against legal actions.  If
1687 1690                                   * the field is of length 0, then the default of
1688 1691                                   * "RESPAWN" is used if the id is numeric,
1689 1692                                   * otherwise the default is "OFF".
1690 1693                                   */
1691 1694                                  if (ptr == shcmd) {
1692 1695                                          if (isdigit(cmd->c_id[0]) &&
1693 1696                                              (cmd->c_id[1] == '\0' ||
1694      -                                                isdigit(cmd->c_id[1])) &&
     1697 +                                            isdigit(cmd->c_id[1])) &&
1695 1698                                              (cmd->c_id[2] == '\0' ||
1696      -                                                isdigit(cmd->c_id[2])) &&
     1699 +                                            isdigit(cmd->c_id[2])) &&
1697 1700                                              (cmd->c_id[3] == '\0' ||
1698      -                                                isdigit(cmd->c_id[3])))
1699      -                                                    cmd->c_action = M_RESPAWN;
     1701 +                                            isdigit(cmd->c_id[3])))
     1702 +                                                cmd->c_action = M_RESPAWN;
1700 1703                                          else
1701      -                                                    cmd->c_action = M_OFF;
     1704 +                                                cmd->c_action = M_OFF;
1702 1705                                  } else {
1703      -                                    for (cmd->c_action = 0, i = 0, *ptr = '\0';
1704      -                                    i < sizeof (actions)/sizeof (char *);
1705      -                                    i++) {
     1706 +                                        for (cmd->c_action = 0, i = 0,
     1707 +                                            *ptr = '\0';
     1708 +                                            i <
     1709 +                                            sizeof (actions)/sizeof (char *);
     1710 +                                            i++) {
1706 1711                                          if (strcmp(shcmd, actions[i]) == 0) {
1707      -                                            if ((cmd->c_levels & MASKSU) &&
1708      -                                                !(act_masks[i] & su_acts))
1709      -                                                    cmd->c_action = 0;
1710      -                                            else
1711      -                                                cmd->c_action = act_masks[i];
1712      -                                            break;
     1712 +                                                if ((cmd->c_levels & MASKSU) &&
     1713 +                                                    !(act_masks[i] & su_acts))
     1714 +                                                        cmd->c_action = 0;
     1715 +                                                else
     1716 +                                                        cmd->c_action =
     1717 +                                                            act_masks[i];
     1718 +                                                break;
1713 1719                                          }
1714      -                                    }
     1720 +                                        }
1715 1721                                  }
1716 1722  
1717 1723                                  /*
1718 1724                                   * If the action didn't match any legal action,
1719 1725                                   * set state to FAILURE.
1720 1726                                   */
1721 1727                                  if (cmd->c_action == 0) {
1722 1728                                          state = FAILURE;
1723 1729                                  } else {
1724 1730                                          state = COMMAND;
1725 1731                                          (void) strcpy(shcmd, "exec ");
1726 1732                                  }
1727 1733                                  ptr = shcmd + EXEC;
1728 1734                                  break;
1729      -                            }
1730      -                            continue;
     1735 +                                }
     1736 +                                continue;
1731 1737                          }
1732      -                    }
     1738 +                }
1733 1739  
1734      -                    /* If the character is a '\n', then this is the end of a */
1735      -                    /* line.  If the '\n' wasn't preceded by a backslash, */
1736      -                    /* it is also the end of an inittab command.  If it was */
1737      -                    /* preceded by a backslash then the next line is a */
1738      -                    /* continuation.  Note that the continuation '\n' falls */
1739      -                    /* through and is treated like other characters and is */
1740      -                    /* stored in the shell command line. */
1741      -                    if (c == '\n' && lastc != '\\') {
1742      -                                proceed = FALSE;
1743      -                                *ptr = '\0';
1744      -                                break;
1745      -                    }
     1740 +                /* If the character is a '\n', then this is the end of a */
     1741 +                /* line.  If the '\n' wasn't preceded by a backslash, */
     1742 +                /* it is also the end of an inittab command.  If it was */
     1743 +                /* preceded by a backslash then the next line is a */
     1744 +                /* continuation.  Note that the continuation '\n' falls */
     1745 +                /* through and is treated like other characters and is */
     1746 +                /* stored in the shell command line. */
     1747 +                if (c == '\n' && lastc != '\\') {
     1748 +                        proceed = FALSE;
     1749 +                        *ptr = '\0';
     1750 +                        break;
     1751 +                }
1746 1752  
1747      -                    /* For all other characters just stuff them into the */
1748      -                    /* command as long as there aren't too many of them. */
1749      -                    /* Make sure there is room for a terminating '\0' also. */
1750      -                    if (ptr >= shcmd + MAXCMDL - 1)
     1753 +                /* For all other characters just stuff them into the */
     1754 +                /* command as long as there aren't too many of them. */
     1755 +                /* Make sure there is room for a terminating '\0' also. */
     1756 +                if (ptr >= shcmd + MAXCMDL - 1)
1751 1757                          state = FAILURE;
1752      -                    else
     1758 +                else
1753 1759                          *ptr++ = (char)c;
1754 1760  
1755      -                    /* If the character we just stored was a quoted     */
1756      -                    /* backslash, then change "c" to '\0', so that this */
1757      -                    /* backslash will not cause a subsequent '\n' to appear */
1758      -                    /* quoted.  In otherwords '\' '\' '\n' is the real end */
1759      -                    /* of a command, while '\' '\n' is a continuation. */
1760      -                    if (c == '\\' && lastc == '\\')
     1761 +                /* If the character we just stored was a quoted */
     1762 +                /* backslash, then change "c" to '\0', so that this     */
     1763 +                /* backslash will not cause a subsequent '\n' to appear */
     1764 +                /* quoted.  In otherwords '\' '\' '\n' is the real end */
     1765 +                /* of a command, while '\' '\n' is a continuation. */
     1766 +                if (c == '\\' && lastc == '\\')
1761 1767                          c = '\0';
1762 1768                  }
1763 1769  
1764 1770                  /*
1765 1771                   * Make sure all the fields are properly specified
1766 1772                   * for a good command line.
1767 1773                   */
1768 1774                  if (state == COMMAND) {
1769 1775                          answer = TRUE;
1770 1776                          cmd->c_command = shcmd;
↓ open down ↓ 332 lines elided ↑ open up ↑
2103 2109                                          for (i = 0; i < maxfiles; i++)
2104 2110                                                  (void) fcntl(i, F_SETFD,
2105 2111                                                      FD_CLOEXEC);
2106 2112                                          (void) execle(SH, "INITSH", "-c",
2107 2113                                              cmd.c_command,
2108 2114                                              (char *)0, glob_envp);
2109 2115                                          console(B_TRUE,
2110 2116  "Command\n\"%s\"\n failed to execute.  errno = %d (exec of shell failed)\n",
2111 2117                                              cmd.c_command, errno);
2112 2118                                          exit(1);
2113      -                                } else while (waitproc(process) == FAILURE);
     2119 +                                } else
     2120 +                                        while (waitproc(process) == FAILURE)
     2121 +                                                ;
2114 2122                                  process->p_flags = 0;
2115 2123                                  st_write();
2116 2124                          }
2117 2125                  }
2118 2126          }
2119 2127  
2120 2128          /* Restore the path. */
2121 2129          free(glob_envp[0]);
2122 2130          glob_envp[0] = old_path;
2123 2131  
↓ open down ↓ 677 lines elided ↑ open up ↑
2801 2809  }
2802 2810  
2803 2811  /*
2804 2812   * prog_name() searches for the word or unix path name and
2805 2813   * returns a pointer to the last element of the pathname.
2806 2814   */
2807 2815  static char *
2808 2816  prog_name(char *string)
2809 2817  {
2810 2818          char    *ptr, *ptr2;
2811      -        /* XXX - utmp - fix name length */
2812      -        static char word[_POSIX_LOGIN_NAME_MAX];
     2819 +        static char word[UT_USER_SZ + 1];
2813 2820  
2814 2821          /*
2815 2822           * Search for the first word skipping leading spaces and tabs.
2816 2823           */
2817 2824          while (*string == ' ' || *string == '\t')
2818 2825                  string++;
2819 2826  
2820 2827          /*
2821 2828           * If the first non-space non-tab character is not one allowed in
2822 2829           * a word, return a pointer to a null string, otherwise parse the
↓ open down ↓ 14 lines elided ↑ open up ↑
2837 2844          for (ptr = string; *string != ' ' && *string != '\t' &&
2838 2845              *string != '\n' && *string != '\0'; string++) {
2839 2846                  if (*string == '/')
2840 2847                          ptr = string+1;
2841 2848          }
2842 2849  
2843 2850          /*
2844 2851           * Copy out up to the size of the "ut_user" array into "word",
2845 2852           * null terminate it and return a pointer to it.
2846 2853           */
2847      -        /* XXX - utmp - fix name length */
2848      -        for (ptr2 = &word[0]; ptr2 < &word[_POSIX_LOGIN_NAME_MAX - 1] &&
     2854 +        for (ptr2 = &word[0]; ptr2 < &word[UT_USER_SZ] &&
2849 2855              ptr < string; /* CSTYLED */)
2850 2856                  *ptr2++ = *ptr++;
2851 2857  
2852 2858          *ptr2 = '\0';
2853 2859          return (&word[0]);
2854 2860  }
2855 2861  
2856 2862  
2857 2863  /*
2858 2864   * realcon() returns a nonzero value if there is a character device
↓ open down ↓ 31 lines elided ↑ open up ↑
2890 2896          /*
2891 2897           * Read in the previous modes for SYSCON from IOCTLSYSCON.
2892 2898           */
2893 2899          if ((fp = fopen(IOCTLSYSCON, "r")) == NULL) {
2894 2900                  stored_syscon_termios = dflt_termios;
2895 2901                  console(B_TRUE,
2896 2902                      "warning:%s does not exist, default settings assumed\n",
2897 2903                      IOCTLSYSCON);
2898 2904          } else {
2899 2905  
2900      -            i = fscanf(fp,
     2906 +                i = fscanf(fp,
2901 2907              "%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x",
2902      -                &iflags, &oflags, &cflags, &lflags,
2903      -                &cc[0], &cc[1], &cc[2], &cc[3], &cc[4], &cc[5], &cc[6],
2904      -                &cc[7], &cc[8], &cc[9], &cc[10], &cc[11], &cc[12], &cc[13],
2905      -                &cc[14], &cc[15], &cc[16], &cc[17]);
     2908 +                    &iflags, &oflags, &cflags, &lflags,
     2909 +                    &cc[0], &cc[1], &cc[2], &cc[3], &cc[4], &cc[5], &cc[6],
     2910 +                    &cc[7], &cc[8], &cc[9], &cc[10], &cc[11], &cc[12], &cc[13],
     2911 +                    &cc[14], &cc[15], &cc[16], &cc[17]);
2906 2912  
2907      -            if (i == 22) {
2908      -                stored_syscon_termios.c_iflag = iflags;
2909      -                stored_syscon_termios.c_oflag = oflags;
2910      -                stored_syscon_termios.c_cflag = cflags;
2911      -                stored_syscon_termios.c_lflag = lflags;
2912      -                for (i = 0; i < 18; i++)
2913      -                        stored_syscon_termios.c_cc[i] = (char)cc[i];
2914      -                valid_format = 1;
2915      -            } else if (i == 13) {
     2913 +                if (i == 22) {
     2914 +                        stored_syscon_termios.c_iflag = iflags;
     2915 +                        stored_syscon_termios.c_oflag = oflags;
     2916 +                        stored_syscon_termios.c_cflag = cflags;
     2917 +                        stored_syscon_termios.c_lflag = lflags;
     2918 +                        for (i = 0; i < 18; i++)
     2919 +                                stored_syscon_termios.c_cc[i] = (char)cc[i];
     2920 +                        valid_format = 1;
     2921 +                } else if (i == 13) {
2916 2922                  rewind(fp);
2917 2923                  i = fscanf(fp, "%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x",
2918 2924                      &iflags, &oflags, &cflags, &lflags, &ldisc, &cc[0], &cc[1],
2919 2925                      &cc[2], &cc[3], &cc[4], &cc[5], &cc[6], &cc[7]);
2920 2926  
2921 2927                  /*
2922 2928                   * If the file is formatted properly, use the values to
2923 2929                   * initialize the console terminal condition.
2924 2930                   */
2925 2931                  stored_syscon_termios.c_iflag = (ushort_t)iflags;
2926 2932                  stored_syscon_termios.c_oflag = (ushort_t)oflags;
2927 2933                  stored_syscon_termios.c_cflag = (ushort_t)cflags;
2928 2934                  stored_syscon_termios.c_lflag = (ushort_t)lflags;
2929 2935                  for (i = 0; i < 8; i++)
2930 2936                          stored_syscon_termios.c_cc[i] = (char)cc[i];
2931 2937                  valid_format = 1;
2932      -            }
2933      -            (void) fclose(fp);
     2938 +                }
     2939 +                (void) fclose(fp);
2934 2940  
2935      -            /* If the file is badly formatted, use the default settings. */
2936      -            if (!valid_format)
2937      -                stored_syscon_termios = dflt_termios;
     2941 +                /* If the file is badly formatted, use the default settings. */
     2942 +                if (!valid_format)
     2943 +                        stored_syscon_termios = dflt_termios;
2938 2944          }
2939 2945  
2940 2946          /* If the file had a bad format, rewrite it later. */
2941 2947          return (!valid_format);
2942 2948  }
2943 2949  
2944 2950  
2945 2951  static void
2946 2952  write_ioctl_syscon()
2947 2953  {
↓ open down ↓ 852 lines elided ↑ open up ↑
3800 3806          (void) sigfillset(&block);
3801 3807          (void) sigprocmask(SIG_BLOCK, &block, &unblock);
3802 3808  
3803 3809  
3804 3810          /*
3805 3811           * On failure we just return because callers of this function check
3806 3812           * for failure.
3807 3813           */
3808 3814          do
3809 3815                  ptr = realloc(g_state, g_state_sz + delta);
3810      -        while (ptr == NULL && errno == EAGAIN);
     3816 +        while (ptr == NULL && errno == EAGAIN)
     3817 +                ;
3811 3818  
3812 3819          if (ptr != NULL) {
3813 3820                  /* ensure that the new part is initialized to zero */
3814 3821                  bzero((caddr_t)ptr + g_state_sz, delta);
3815 3822  
3816 3823                  g_state = ptr;
3817 3824                  g_state_sz += delta;
3818 3825                  num_proc <<= 1;
3819 3826          }
3820 3827  
↓ open down ↓ 86 lines elided ↑ open up ↑
3907 3914  
3908 3915          do {
3909 3916                  st_fd = open(init_state_file, O_RDWR, S_IRUSR | S_IWUSR);
3910 3917          } while (st_fd == -1 && errno == EINTR);
3911 3918          if (st_fd == -1)
3912 3919                  goto new_state;
3913 3920  
3914 3921          /* Get the size of the file. */
3915 3922          do
3916 3923                  ret = fstat(st_fd, &stb);
3917      -        while (ret == -1 && errno == EINTR);
     3924 +        while (ret == -1 && errno == EINTR)
     3925 +                ;
3918 3926          if (ret == -1)
3919 3927                  goto new_state;
3920 3928  
3921 3929          do
3922 3930                  g_state = malloc(stb.st_size);
3923      -        while (g_state == NULL && errno == EAGAIN);
     3931 +        while (g_state == NULL && errno == EAGAIN)
     3932 +                ;
3924 3933          if (g_state == NULL)
3925 3934                  goto new_state;
3926 3935  
3927 3936          to_be_read = stb.st_size;
3928 3937          ptr = (char *)g_state;
3929 3938          while (to_be_read > 0) {
3930 3939                  ssize_t read_ret;
3931 3940  
3932 3941                  read_ret = read(st_fd, ptr, to_be_read);
3933 3942                  if (read_ret < 0) {
↓ open down ↓ 25 lines elided ↑ open up ↑
3959 3968                  (void) unlink(init_state_file);
3960 3969  
3961 3970          if (g_state != NULL)
3962 3971                  free(g_state);
3963 3972  
3964 3973          /* Something went wrong, so allocate new state. */
3965 3974          g_state_sz = sizeof (struct init_state) +
3966 3975              ((init_num_proc - 1) * sizeof (struct PROC_TABLE));
3967 3976          do
3968 3977                  g_state = calloc(1, g_state_sz);
3969      -        while (g_state == NULL && errno == EAGAIN);
     3978 +        while (g_state == NULL && errno == EAGAIN)
     3979 +                ;
3970 3980          if (g_state == NULL) {
3971 3981                  /* Fatal error! */
3972 3982                  exit(errno);
3973 3983          }
3974 3984  
3975 3985          g_state->ist_runlevel = -1;
3976 3986          num_proc = init_num_proc;
3977 3987  
3978 3988          if (!booting) {
3979 3989                  console(B_TRUE, "Restarting.\n");
↓ open down ↓ 87 lines elided ↑ open up ↑
4067 4077  contract_make_template(uint_t info, uint_t critical, uint_t fatal,
4068 4078      uint64_t cookie)
4069 4079  {
4070 4080          int fd, err;
4071 4081  
4072 4082          char *ioctl_tset_emsg =
4073 4083              "Couldn't set \"%s\" contract template parameter: %s.\n";
4074 4084  
4075 4085          do
4076 4086                  fd = open64(CTFS_ROOT "/process/template", O_RDWR);
4077      -        while (fd < 0 && errno == EINTR);
     4087 +        while (fd < 0 && errno == EINTR)
     4088 +                ;
4078 4089          if (fd < 0) {
4079 4090                  console(B_TRUE, "Couldn't create process template: %s.\n",
4080 4091                      strerror(errno));
4081 4092                  return (-1);
4082 4093          }
4083 4094  
4084 4095          if (err = ct_pr_tmpl_set_param(fd, CT_PR_INHERIT | CT_PR_REGENT))
4085 4096                  console(B_TRUE, "Contract set template inherit, regent "
4086 4097                      "failed: %s.\n", strerror(err));
4087 4098  
↓ open down ↓ 76 lines elided ↑ open up ↑
4164 4175                      "Ignoring contract events.  Core smf(5) services will not "
4165 4176                      "be restarted.\n");
4166 4177                  return;
4167 4178          }
4168 4179  
4169 4180          /*
4170 4181           * Open an event endpoint.
4171 4182           */
4172 4183          do
4173 4184                  fd = open64(CTFS_ROOT "/process/pbundle", O_RDONLY);
4174      -        while (fd < 0 && errno == EINTR);
     4185 +        while (fd < 0 && errno == EINTR)
     4186 +                ;
4175 4187          if (fd < 0) {
4176 4188                  console(B_TRUE,
4177 4189                      "Couldn't open process pbundle: %s.  Core smf(5) services "
4178 4190                      "will not be restarted.\n", strerror(errno));
4179 4191                  return;
4180 4192          }
4181 4193  
4182 4194          if (dup2(fd, 253) == -1) {
4183 4195                  console(B_TRUE, "Could not duplicate process bundle: %s.\n",
4184 4196                      strerror(errno));
↓ open down ↓ 12 lines elided ↑ open up ↑
4197 4209          poll_nfds = 1;
4198 4210  }
4199 4211  
4200 4212  static int
4201 4213  contract_getfile(ctid_t id, const char *name, int oflag)
4202 4214  {
4203 4215          int fd;
4204 4216  
4205 4217          do
4206 4218                  fd = contract_open(id, "process", name, oflag);
4207      -        while (fd < 0 && errno == EINTR);
     4219 +        while (fd < 0 && errno == EINTR)
     4220 +                ;
4208 4221  
4209 4222          if (fd < 0)
4210 4223                  console(B_TRUE, "Couldn't open %s for contract %ld: %s.\n",
4211 4224                      name, id, strerror(errno));
4212 4225  
4213 4226          return (fd);
4214 4227  }
4215 4228  
4216 4229  static int
4217 4230  contract_cookie(ctid_t id, uint64_t *cp)
↓ open down ↓ 371 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX