Print this page
2989 Eliminate use of LOGNAME_MAX in ON
1166 useradd have warning with name more 8 chars
*** 18,27 ****
--- 18,29 ----
*
* CDDL HEADER END
*/
/*
+ * Copyright (c) 2013 Gary Mills
+ *
* Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
*** 137,146 ****
--- 139,149 ----
#define TRUE 1
#define FALSE 0
#define FAILURE -1
+ #define UT_USER_SZ 32 /* Size of a utmpx ut_user field */
#define UT_LINE_SZ 32 /* Size of a utmpx ut_line field */
/*
* SLEEPTIME The number of seconds "init" sleeps between wakeups if
* nothing else requires this "init" wakeup.
*** 1698,1716 ****
isdigit(cmd->c_id[3])))
cmd->c_action = M_RESPAWN;
else
cmd->c_action = M_OFF;
} else {
! for (cmd->c_action = 0, i = 0, *ptr = '\0';
! i < sizeof (actions)/sizeof (char *);
i++) {
if (strcmp(shcmd, actions[i]) == 0) {
if ((cmd->c_levels & MASKSU) &&
!(act_masks[i] & su_acts))
cmd->c_action = 0;
else
! cmd->c_action = act_masks[i];
break;
}
}
}
--- 1701,1722 ----
isdigit(cmd->c_id[3])))
cmd->c_action = M_RESPAWN;
else
cmd->c_action = M_OFF;
} else {
! for (cmd->c_action = 0, i = 0,
! *ptr = '\0';
! i <
! sizeof (actions)/sizeof (char *);
i++) {
if (strcmp(shcmd, actions[i]) == 0) {
if ((cmd->c_levels & MASKSU) &&
!(act_masks[i] & su_acts))
cmd->c_action = 0;
else
! cmd->c_action =
! act_masks[i];
break;
}
}
}
*** 2108,2118 ****
(char *)0, glob_envp);
console(B_TRUE,
"Command\n\"%s\"\n failed to execute. errno = %d (exec of shell failed)\n",
cmd.c_command, errno);
exit(1);
! } else while (waitproc(process) == FAILURE);
process->p_flags = 0;
st_write();
}
}
}
--- 2114,2126 ----
(char *)0, glob_envp);
console(B_TRUE,
"Command\n\"%s\"\n failed to execute. errno = %d (exec of shell failed)\n",
cmd.c_command, errno);
exit(1);
! } else
! while (waitproc(process) == FAILURE)
! ;
process->p_flags = 0;
st_write();
}
}
}
*** 2806,2817 ****
*/
static char *
prog_name(char *string)
{
char *ptr, *ptr2;
! /* XXX - utmp - fix name length */
! static char word[_POSIX_LOGIN_NAME_MAX];
/*
* Search for the first word skipping leading spaces and tabs.
*/
while (*string == ' ' || *string == '\t')
--- 2814,2824 ----
*/
static char *
prog_name(char *string)
{
char *ptr, *ptr2;
! static char word[UT_USER_SZ + 1];
/*
* Search for the first word skipping leading spaces and tabs.
*/
while (*string == ' ' || *string == '\t')
*** 2842,2853 ****
/*
* Copy out up to the size of the "ut_user" array into "word",
* null terminate it and return a pointer to it.
*/
! /* XXX - utmp - fix name length */
! for (ptr2 = &word[0]; ptr2 < &word[_POSIX_LOGIN_NAME_MAX - 1] &&
ptr < string; /* CSTYLED */)
*ptr2++ = *ptr++;
*ptr2 = '\0';
return (&word[0]);
--- 2849,2859 ----
/*
* Copy out up to the size of the "ut_user" array into "word",
* null terminate it and return a pointer to it.
*/
! for (ptr2 = &word[0]; ptr2 < &word[UT_USER_SZ] &&
ptr < string; /* CSTYLED */)
*ptr2++ = *ptr++;
*ptr2 = '\0';
return (&word[0]);
*** 3805,3815 ****
* On failure we just return because callers of this function check
* for failure.
*/
do
ptr = realloc(g_state, g_state_sz + delta);
! while (ptr == NULL && errno == EAGAIN);
if (ptr != NULL) {
/* ensure that the new part is initialized to zero */
bzero((caddr_t)ptr + g_state_sz, delta);
--- 3811,3822 ----
* On failure we just return because callers of this function check
* for failure.
*/
do
ptr = realloc(g_state, g_state_sz + delta);
! while (ptr == NULL && errno == EAGAIN)
! ;
if (ptr != NULL) {
/* ensure that the new part is initialized to zero */
bzero((caddr_t)ptr + g_state_sz, delta);
*** 3912,3928 ****
goto new_state;
/* Get the size of the file. */
do
ret = fstat(st_fd, &stb);
! while (ret == -1 && errno == EINTR);
if (ret == -1)
goto new_state;
do
g_state = malloc(stb.st_size);
! while (g_state == NULL && errno == EAGAIN);
if (g_state == NULL)
goto new_state;
to_be_read = stb.st_size;
ptr = (char *)g_state;
--- 3919,3937 ----
goto new_state;
/* Get the size of the file. */
do
ret = fstat(st_fd, &stb);
! while (ret == -1 && errno == EINTR)
! ;
if (ret == -1)
goto new_state;
do
g_state = malloc(stb.st_size);
! while (g_state == NULL && errno == EAGAIN)
! ;
if (g_state == NULL)
goto new_state;
to_be_read = stb.st_size;
ptr = (char *)g_state;
*** 3964,3974 ****
/* Something went wrong, so allocate new state. */
g_state_sz = sizeof (struct init_state) +
((init_num_proc - 1) * sizeof (struct PROC_TABLE));
do
g_state = calloc(1, g_state_sz);
! while (g_state == NULL && errno == EAGAIN);
if (g_state == NULL) {
/* Fatal error! */
exit(errno);
}
--- 3973,3984 ----
/* Something went wrong, so allocate new state. */
g_state_sz = sizeof (struct init_state) +
((init_num_proc - 1) * sizeof (struct PROC_TABLE));
do
g_state = calloc(1, g_state_sz);
! while (g_state == NULL && errno == EAGAIN)
! ;
if (g_state == NULL) {
/* Fatal error! */
exit(errno);
}
*** 4072,4082 ****
char *ioctl_tset_emsg =
"Couldn't set \"%s\" contract template parameter: %s.\n";
do
fd = open64(CTFS_ROOT "/process/template", O_RDWR);
! while (fd < 0 && errno == EINTR);
if (fd < 0) {
console(B_TRUE, "Couldn't create process template: %s.\n",
strerror(errno));
return (-1);
}
--- 4082,4093 ----
char *ioctl_tset_emsg =
"Couldn't set \"%s\" contract template parameter: %s.\n";
do
fd = open64(CTFS_ROOT "/process/template", O_RDWR);
! while (fd < 0 && errno == EINTR)
! ;
if (fd < 0) {
console(B_TRUE, "Couldn't create process template: %s.\n",
strerror(errno));
return (-1);
}
*** 4169,4179 ****
/*
* Open an event endpoint.
*/
do
fd = open64(CTFS_ROOT "/process/pbundle", O_RDONLY);
! while (fd < 0 && errno == EINTR);
if (fd < 0) {
console(B_TRUE,
"Couldn't open process pbundle: %s. Core smf(5) services "
"will not be restarted.\n", strerror(errno));
return;
--- 4180,4191 ----
/*
* Open an event endpoint.
*/
do
fd = open64(CTFS_ROOT "/process/pbundle", O_RDONLY);
! while (fd < 0 && errno == EINTR)
! ;
if (fd < 0) {
console(B_TRUE,
"Couldn't open process pbundle: %s. Core smf(5) services "
"will not be restarted.\n", strerror(errno));
return;
*** 4202,4212 ****
{
int fd;
do
fd = contract_open(id, "process", name, oflag);
! while (fd < 0 && errno == EINTR);
if (fd < 0)
console(B_TRUE, "Couldn't open %s for contract %ld: %s.\n",
name, id, strerror(errno));
--- 4214,4225 ----
{
int fd;
do
fd = contract_open(id, "process", name, oflag);
! while (fd < 0 && errno == EINTR)
! ;
if (fd < 0)
console(B_TRUE, "Couldn't open %s for contract %ld: %s.\n",
name, id, strerror(errno));