* subshell.c: Use "rn" at the end of all error messages.

Don't use perror().  Make error messages more exact.
This commit is contained in:
Pavel Roskin 2004-02-10 00:11:09 +00:00
parent 739bb2edfe
commit 7eb0ef8bd2
2 changed files with 241 additions and 227 deletions

View File

@ -1,3 +1,8 @@
2004-02-09 Pavel Roskin <proski@gnu.org>
* subshell.c: Use "\r\n" at the end of all error messages.
Don't use perror(). Make error messages more exact.
2004-01-23 Pavel Roskin <proski@gnu.org> 2004-01-23 Pavel Roskin <proski@gnu.org>
* utilunix.c (canonicalize_pathname): Add support for UNC paths. * utilunix.c (canonicalize_pathname): Add support for UNC paths.

View File

@ -157,7 +157,8 @@ static int prompt_pos;
* *
* Returns: never. * Returns: never.
*/ */
static void init_subshell_child (const char *pty_name) static void
init_subshell_child (const char *pty_name)
{ {
int pty_slave; int pty_slave;
char *init_file = NULL; char *init_file = NULL;
@ -195,9 +196,9 @@ static void init_subshell_child (const char *pty_name)
/* TOSTOP, which keeps background processes from writing to the pty */ /* TOSTOP, which keeps background processes from writing to the pty */
shell_mode.c_lflag |= TOSTOP; /* So background writers get SIGTTOU */ shell_mode.c_lflag |= TOSTOP; /* So background writers get SIGTTOU */
if (tcsetattr (pty_slave, TCSANOW, &shell_mode)) if (tcsetattr (pty_slave, TCSANOW, &shell_mode)) {
{ fprintf (stderr, "Cannot set pty terminal modes: %s\r\n",
perror (__FILE__": couldn't set pty terminal modes"); unix_error_string (errno));
_exit (FORK_FAILURE); _exit (FORK_FAILURE);
} }
@ -216,13 +217,13 @@ static void init_subshell_child (const char *pty_name)
mc_sid = getsid (0); mc_sid = getsid (0);
if (mc_sid != -1) { if (mc_sid != -1) {
char sid_str[BUF_SMALL]; char sid_str[BUF_SMALL];
g_snprintf (sid_str, sizeof (sid_str), "MC_SID=%ld", (long) mc_sid); g_snprintf (sid_str, sizeof (sid_str), "MC_SID=%ld",
(long) mc_sid);
putenv (sid_str); putenv (sid_str);
} }
#endif /* HAVE_GETSID */ #endif /* HAVE_GETSID */
switch (subshell_type) switch (subshell_type) {
{
case BASH: case BASH:
init_file = ".mc/bashrc"; init_file = ".mc/bashrc";
if (access (init_file, R_OK) == -1) if (access (init_file, R_OK) == -1)
@ -238,11 +239,12 @@ static void init_subshell_child (const char *pty_name)
break; break;
/* TODO: Find a way to pass initfile to TCSH and ZSH */ /* TODO: Find a way to pass initfile to TCSH and ZSH */
case TCSH: case ZSH: case TCSH:
case ZSH:
break; break;
default: default:
fprintf (stderr, __FILE__": unimplemented subshell type %d\n", fprintf (stderr, __FILE__ ": unimplemented subshell type %d\r\n",
subshell_type); subshell_type);
_exit (FORK_FAILURE); _exit (FORK_FAILURE);
} }
@ -262,8 +264,7 @@ static void init_subshell_child (const char *pty_name)
close (subshell_pipe[READ]); close (subshell_pipe[READ]);
close (pty_slave); /* These may be FD_CLOEXEC, but just in case... */ close (pty_slave); /* These may be FD_CLOEXEC, but just in case... */
switch (subshell_type) switch (subshell_type) {
{
case BASH: case BASH:
execl (shell, "bash", "-rcfile", init_file, NULL); execl (shell, "bash", "-rcfile", init_file, NULL);
break; break;
@ -339,7 +340,8 @@ check_sid ()
* quit - Can be set to SUBSHELL_EXIT by the SIGCHLD handler * quit - Can be set to SUBSHELL_EXIT by the SIGCHLD handler
*/ */
void init_subshell (void) void
init_subshell (void)
{ {
/* This must be remembered across calls to init_subshell() */ /* This must be remembered across calls to init_subshell() */
static char pty_name[BUF_SMALL]; static char pty_name[BUF_SMALL];
@ -362,18 +364,16 @@ void init_subshell (void)
/* a raw mode based on it now, before we do anything else with it */ /* a raw mode based on it now, before we do anything else with it */
init_raw_mode (); init_raw_mode ();
if (subshell_pty == 0) /* First time through */ if (subshell_pty == 0) { /* First time through */
{
/* Find out what type of shell we have */ /* Find out what type of shell we have */
if (strstr (shell, "/zsh") || getenv("ZSH_VERSION")) if (strstr (shell, "/zsh") || getenv ("ZSH_VERSION"))
subshell_type = ZSH; subshell_type = ZSH;
else if (strstr (shell, "/tcsh")) else if (strstr (shell, "/tcsh"))
subshell_type = TCSH; subshell_type = TCSH;
else if (strstr (shell, "/bash") || getenv ("BASH")) else if (strstr (shell, "/bash") || getenv ("BASH"))
subshell_type = BASH; subshell_type = BASH;
else else {
{
use_subshell = FALSE; use_subshell = FALSE;
return; return;
} }
@ -383,18 +383,16 @@ void init_subshell (void)
/* FIXME: We may need to open a fresh pty each time on SVR4 */ /* FIXME: We may need to open a fresh pty each time on SVR4 */
subshell_pty = pty_open_master (pty_name); subshell_pty = pty_open_master (pty_name);
if (subshell_pty == -1) if (subshell_pty == -1) {
{ fprintf (stderr, "Cannot open master side of pty (%s): %s\r\n",
fputs (__FILE__": couldn't open master side of pty\n", stderr); pty_name, unix_error_string (errno));
perror ("pty_open_master");
use_subshell = FALSE; use_subshell = FALSE;
return; return;
} }
pty_slave = pty_open_slave (pty_name); pty_slave = pty_open_slave (pty_name);
if (pty_slave == -1) if (pty_slave == -1) {
{ fprintf (stderr, "Cannot open slave side of pty %s: %s\r\n",
fprintf (stderr, "couldn't open slave side of pty (%s)\n\r", pty_name, unix_error_string (errno));
pty_name);
use_subshell = FALSE; use_subshell = FALSE;
return; return;
} }
@ -406,32 +404,29 @@ void init_subshell (void)
/* Create a pipe for receiving the subshell's CWD */ /* Create a pipe for receiving the subshell's CWD */
if (subshell_type == TCSH) if (subshell_type == TCSH) {
{
g_snprintf (tcsh_fifo, sizeof (tcsh_fifo), "%s/mc.pipe.%d", g_snprintf (tcsh_fifo, sizeof (tcsh_fifo), "%s/mc.pipe.%d",
mc_tmpdir(), getpid ()); mc_tmpdir (), getpid ());
if (mkfifo (tcsh_fifo, 0600) == -1) if (mkfifo (tcsh_fifo, 0600) == -1) {
{ fprintf (stderr, "mkfifo(%s) failed: %s\r\n", tcsh_fifo,
perror (__FILE__": mkfifo"); unix_error_string (errno));
use_subshell = FALSE; use_subshell = FALSE;
return; return;
} }
/* Opening the FIFO as O_RDONLY or O_WRONLY causes deadlock */ /* Opening the FIFO as O_RDONLY or O_WRONLY causes deadlock */
if ((subshell_pipe[READ] = open (tcsh_fifo, O_RDWR)) == -1 || if ((subshell_pipe[READ] = open (tcsh_fifo, O_RDWR)) == -1
(subshell_pipe[WRITE] = open (tcsh_fifo, O_RDWR)) == -1) || (subshell_pipe[WRITE] =
{ open (tcsh_fifo, O_RDWR)) == -1) {
fprintf (stderr, _("Cannot open named pipe %s\n"), tcsh_fifo); fprintf (stderr, _("Cannot open named pipe %s: %s\r\n"),
perror (__FILE__": open"); tcsh_fifo, unix_error_string (errno));
use_subshell = FALSE; use_subshell = FALSE;
return; return;
} }
} } else /* subshell_type is BASH or ZSH */ if (pipe (subshell_pipe)) {
else /* subshell_type is BASH or ZSH */ fprintf (stderr, _("Cannot create pipe pair: %s\r\n"),
if (pipe (subshell_pipe)) unix_error_string (errno));
{
perror (__FILE__": couldn't create pipe");
use_subshell = FALSE; use_subshell = FALSE;
return; return;
} }
@ -443,35 +438,35 @@ void init_subshell (void)
subshell_stopped = FALSE; subshell_stopped = FALSE;
subshell_pid = fork (); subshell_pid = fork ();
if (subshell_pid == -1) if (subshell_pid == -1) {
{ fprintf (stderr, "Cannot spawn the subshell process: %s\r\n",
perror (__FILE__": couldn't spawn the subshell process"); unix_error_string (errno));
/* We exit here because, if the process table is full, the */ /* We exit here because, if the process table is full, the */
/* other method of running user commands won't work either */ /* other method of running user commands won't work either */
exit (1); exit (1);
} }
if (subshell_pid == 0) /* We are in the child process */ if (subshell_pid == 0) { /* We are in the child process */
{
init_subshell_child (pty_name); init_subshell_child (pty_name);
} }
/* pty_slave is only opened when called the first time */ /* pty_slave is only opened when called the first time */
if (pty_slave != -1) { if (pty_slave != -1) {
close(pty_slave); close (pty_slave);
} }
/* Set up `precmd' or equivalent for reading the subshell's CWD */ /* Set up `precmd' or equivalent for reading the subshell's CWD */
switch (subshell_type) switch (subshell_type) {
{
case BASH: case BASH:
g_snprintf (precmd, sizeof (precmd), " PROMPT_COMMAND='pwd>&%d;kill -STOP $$'\n", g_snprintf (precmd, sizeof (precmd),
" PROMPT_COMMAND='pwd>&%d;kill -STOP $$'\n",
subshell_pipe[WRITE]); subshell_pipe[WRITE]);
break; break;
case ZSH: case ZSH:
g_snprintf (precmd, sizeof (precmd), " precmd(){ pwd>&%d;kill -STOP $$ }\n", g_snprintf (precmd, sizeof (precmd),
" precmd(){ pwd>&%d;kill -STOP $$ }\n",
subshell_pipe[WRITE]); subshell_pipe[WRITE]);
break; break;
@ -488,7 +483,7 @@ void init_subshell (void)
subshell_state = RUNNING_COMMAND; subshell_state = RUNNING_COMMAND;
enable_interrupt_key (); enable_interrupt_key ();
if (!feed_subshell (QUIETLY, TRUE)){ if (!feed_subshell (QUIETLY, TRUE)) {
use_subshell = FALSE; use_subshell = FALSE;
} }
disable_interrupt_key (); disable_interrupt_key ();
@ -568,33 +563,33 @@ int invoke_subshell (const char *command, int how, char **new_dir)
} }
int read_subshell_prompt (void) int
read_subshell_prompt (void)
{ {
static int prompt_size = INITIAL_PROMPT_SIZE; static int prompt_size = INITIAL_PROMPT_SIZE;
int bytes = 0, i, rc = 0; int bytes = 0, i, rc = 0;
struct timeval timeleft = {0, 0}; struct timeval timeleft = { 0, 0 };
fd_set tmp; fd_set tmp;
FD_ZERO (&tmp); FD_ZERO (&tmp);
FD_SET (subshell_pty, &tmp); FD_SET (subshell_pty, &tmp);
if (subshell_prompt == NULL) /* First time through */ if (subshell_prompt == NULL) { /* First time through */
{
subshell_prompt = (char *) g_malloc (prompt_size); subshell_prompt = (char *) g_malloc (prompt_size);
*subshell_prompt = '\0'; *subshell_prompt = '\0';
prompt_pos = 0; prompt_pos = 0;
} }
while (subshell_alive && while (subshell_alive
(rc = select (subshell_pty + 1, &tmp, NULL, NULL, &timeleft))) && (rc =
{ select (subshell_pty + 1, &tmp, NULL, NULL, &timeleft))) {
/* Check for `select' errors */ /* Check for `select' errors */
if (rc == -1) { if (rc == -1) {
if (errno == EINTR) if (errno == EINTR)
continue; continue;
else { else {
tcsetattr (STDOUT_FILENO, TCSANOW, &shell_mode); fprintf (stderr, "select (FD_SETSIZE, &tmp...): %s\r\n",
perror ("\n"__FILE__": select (FD_SETSIZE, &tmp...)"); unix_error_string (errno));
exit (1); exit (1);
} }
} }
@ -603,17 +598,18 @@ int read_subshell_prompt (void)
/* Extract the prompt from the shell output */ /* Extract the prompt from the shell output */
for (i=0; i<bytes; ++i) for (i = 0; i < bytes; ++i)
if (pty_buffer[i] == '\n' || pty_buffer[i] == '\r'){ if (pty_buffer[i] == '\n' || pty_buffer[i] == '\r') {
prompt_pos = 0; prompt_pos = 0;
} else { } else {
if (!pty_buffer [i]) if (!pty_buffer[i])
continue; continue;
subshell_prompt[prompt_pos++] = pty_buffer[i]; subshell_prompt[prompt_pos++] = pty_buffer[i];
if (prompt_pos == prompt_size) if (prompt_pos == prompt_size)
subshell_prompt = (char *) g_realloc (subshell_prompt, subshell_prompt =
prompt_size *= 2); (char *) g_realloc (subshell_prompt, prompt_size *=
2);
} }
subshell_prompt[prompt_pos] = '\0'; subshell_prompt[prompt_pos] = '\0';
@ -645,18 +641,21 @@ void resize_subshell (void)
resize_tty (subshell_pty); resize_tty (subshell_pty);
} }
int exit_subshell (void) int
exit_subshell (void)
{ {
int quit = TRUE; int quit = TRUE;
if (subshell_state != INACTIVE && subshell_alive) if (subshell_state != INACTIVE && subshell_alive)
quit = !query_dialog (_("Warning"), _(" The shell is still active. Quit anyway? "), quit =
!query_dialog (_("Warning"),
_(" The shell is still active. Quit anyway? "),
0, 2, _("&Yes"), _("&No")); 0, 2, _("&Yes"), _("&No"));
if (quit && subshell_type == TCSH) if (quit && subshell_type == TCSH) {
{
if (unlink (tcsh_fifo) == -1) if (unlink (tcsh_fifo) == -1)
perror (__FILE__": couldn't remove named pipe /tmp/mc.pipe.NNN"); fprintf (stderr, "Cannot remove named pipe %s: %s\r\n",
tcsh_fifo, unix_error_string (errno));
} }
g_free (subshell_prompt); g_free (subshell_prompt);
@ -752,9 +751,12 @@ subshell_name_quote (const char *s)
/* If it actually changed the directory it returns true */ /* If it actually changed the directory it returns true */
void do_subshell_chdir (const char *directory, int do_update, int reset_prompt) void
do_subshell_chdir (const char *directory, int do_update, int reset_prompt)
{ {
if (!(subshell_state == INACTIVE && strcmp (subshell_cwd, current_panel->cwd))){ if (!
(subshell_state == INACTIVE
&& strcmp (subshell_cwd, current_panel->cwd))) {
/* We have to repaint the subshell prompt if we read it from /* We have to repaint the subshell prompt if we read it from
* the main program. Please note that in the code after this * the main program. Please note that in the code after this
* if, the cd command that is sent will make the subshell * if, the cd command that is sent will make the subshell
@ -786,8 +788,10 @@ void do_subshell_chdir (const char *directory, int do_update, int reset_prompt)
subshell_state = RUNNING_COMMAND; subshell_state = RUNNING_COMMAND;
feed_subshell (QUIETLY, FALSE); feed_subshell (QUIETLY, FALSE);
if (subshell_alive && strcmp (subshell_cwd, current_panel->cwd) && strcmp (current_panel->cwd, ".")) if (subshell_alive && strcmp (subshell_cwd, current_panel->cwd)
fprintf (stderr, _("Warning: Cannot change to %s.\n"), current_panel->cwd); && strcmp (current_panel->cwd, "."))
fprintf (stderr, _("Warning: Cannot change to %s.\r\n"),
current_panel->cwd);
if (reset_prompt) if (reset_prompt)
prompt_pos = 0; prompt_pos = 0;
@ -797,13 +801,14 @@ void do_subshell_chdir (const char *directory, int do_update, int reset_prompt)
} }
void subshell_get_console_attributes (void) void
subshell_get_console_attributes (void)
{ {
/* Get our current terminal modes */ /* Get our current terminal modes */
if (tcgetattr (STDOUT_FILENO, &shell_mode)) if (tcgetattr (STDOUT_FILENO, &shell_mode)) {
{ fprintf (stderr, "Cannot get terminal settings: %s\r\n",
perror (__FILE__": couldn't get terminal settings"); unix_error_string (errno));
use_subshell = FALSE; use_subshell = FALSE;
return; return;
} }
@ -864,7 +869,8 @@ sigchld_handler (int sig)
/* Feed the subshell our keyboard input until it says it's finished */ /* Feed the subshell our keyboard input until it says it's finished */
static int feed_subshell (int how, int fail_on_error) static int
feed_subshell (int how, int fail_on_error)
{ {
fd_set read_set; /* For `select' */ fd_set read_set; /* For `select' */
int maxfdp; int maxfdp;
@ -894,13 +900,14 @@ static int feed_subshell (int how, int fail_on_error)
maxfdp = max (maxfdp, STDIN_FILENO); maxfdp = max (maxfdp, STDIN_FILENO);
} }
if (select (maxfdp + 1, &read_set, NULL, NULL, wptr) == -1){ if (select (maxfdp + 1, &read_set, NULL, NULL, wptr) == -1) {
/* Despite using SA_RESTART, we still have to check for this */ /* Despite using SA_RESTART, we still have to check for this */
if (errno == EINTR) if (errno == EINTR)
continue; /* try all over again */ continue; /* try all over again */
tcsetattr (STDOUT_FILENO, TCSANOW, &shell_mode); tcsetattr (STDOUT_FILENO, TCSANOW, &shell_mode);
perror ("\n"__FILE__": select (FD_SETSIZE, &read_set...)"); fprintf (stderr, "select (FD_SETSIZE, &read_set...): %s\r\n",
unix_error_string (errno));
exit (1); exit (1);
} }
@ -918,10 +925,10 @@ static int feed_subshell (int how, int fail_on_error)
if (bytes == -1 && errno == EIO && !subshell_alive) if (bytes == -1 && errno == EIO && !subshell_alive)
return FALSE; return FALSE;
if (bytes <= 0) if (bytes <= 0) {
{
tcsetattr (STDOUT_FILENO, TCSANOW, &shell_mode); tcsetattr (STDOUT_FILENO, TCSANOW, &shell_mode);
perror ("\n"__FILE__": read (subshell_pty...)"); fprintf (stderr, "read (subshell_pty...): %s\r\n",
unix_error_string (errno));
exit (1); exit (1);
} }
@ -933,21 +940,22 @@ static int feed_subshell (int how, int fail_on_error)
/* Read the subshell's CWD and capture its prompt */ /* Read the subshell's CWD and capture its prompt */
{ {
bytes = read (subshell_pipe[READ], subshell_cwd, MC_MAXPATHLEN+1); bytes =
if (bytes <= 0) read (subshell_pipe[READ], subshell_cwd,
{ MC_MAXPATHLEN + 1);
if (bytes <= 0) {
tcsetattr (STDOUT_FILENO, TCSANOW, &shell_mode); tcsetattr (STDOUT_FILENO, TCSANOW, &shell_mode);
perror ("\n"__FILE__": read (subshell_pipe[READ]...)"); fprintf (stderr, "read (subshell_pipe[READ]...): %s\r\n",
unix_error_string (errno));
exit (1); exit (1);
} }
subshell_cwd[bytes-1] = 0; /* Squash the final '\n' */ subshell_cwd[bytes - 1] = 0; /* Squash the final '\n' */
synchronize (); synchronize ();
subshell_ready = TRUE; subshell_ready = TRUE;
if (subshell_state == RUNNING_COMMAND) if (subshell_state == RUNNING_COMMAND) {
{
subshell_state = INACTIVE; subshell_state = INACTIVE;
return 1; return 1;
} }
@ -957,16 +965,16 @@ static int feed_subshell (int how, int fail_on_error)
/* Read from stdin, write to the subshell */ /* Read from stdin, write to the subshell */
{ {
bytes = read (STDIN_FILENO, pty_buffer, pty_buffer_size); bytes = read (STDIN_FILENO, pty_buffer, pty_buffer_size);
if (bytes <= 0) if (bytes <= 0) {
{
tcsetattr (STDOUT_FILENO, TCSANOW, &shell_mode); tcsetattr (STDOUT_FILENO, TCSANOW, &shell_mode);
perror ("\n"__FILE__": read (STDIN_FILENO, pty_buffer...)"); fprintf (stderr,
"read (STDIN_FILENO, pty_buffer...): %s\r\n",
unix_error_string (errno));
exit (1); exit (1);
} }
for (i=0; i<bytes; ++i) for (i = 0; i < bytes; ++i)
if (pty_buffer[i] == subshell_switch_key) if (pty_buffer[i] == subshell_switch_key) {
{
write (subshell_pty, pty_buffer, i); write (subshell_pty, pty_buffer, i);
if (subshell_ready) if (subshell_ready)
subshell_state = INACTIVE; subshell_state = INACTIVE;
@ -1051,39 +1059,40 @@ static int pty_open_master (char *pty_name)
} }
/* System V version of pty_open_slave */ /* System V version of pty_open_slave */
static int pty_open_slave (const char *pty_name) static int
pty_open_slave (const char *pty_name)
{ {
int pty_slave = open (pty_name, O_RDWR); int pty_slave = open (pty_name, O_RDWR);
if (pty_slave == -1) if (pty_slave == -1) {
{ fprintf (stderr, "open (%s, O_RDWR): %s\r\n", pty_name,
perror ("open (pty_name, O_RDWR)"); unix_error_string (errno));
return -1; return -1;
} }
#if !defined(__osf__) && !defined(__linux__) #if !defined(__osf__) && !defined(__linux__)
#if defined (I_FIND) && defined (I_PUSH) #if defined (I_FIND) && defined (I_PUSH)
if (!ioctl (pty_slave, I_FIND, "ptem")) if (!ioctl (pty_slave, I_FIND, "ptem"))
if (ioctl (pty_slave, I_PUSH, "ptem") == -1) if (ioctl (pty_slave, I_PUSH, "ptem") == -1) {
{ fprintf (stderr, "ioctl (%s, I_PUSH, \"ptem\") failed: %s\r\n",
fprintf (stderr, "ioctl (pty_slave, I_PUSH, \"ptem\") failed\n"); pty_slave, unix_error_string (errno));
close (pty_slave); close (pty_slave);
return -1; return -1;
} }
if (!ioctl (pty_slave, I_FIND, "ldterm")) if (!ioctl (pty_slave, I_FIND, "ldterm"))
if (ioctl (pty_slave, I_PUSH, "ldterm") == -1) if (ioctl (pty_slave, I_PUSH, "ldterm") == -1) {
{ fprintf (stderr,
fprintf (stderr, "ioctl (pty_slave, I_PUSH, \"ldterm\") failed\n"); "ioctl (%s, I_PUSH, \"ldterm\") failed: %s\r\n",
pty_slave, unix_error_string (errno));
close (pty_slave); close (pty_slave);
return -1; return -1;
} }
#if !defined(sgi) && !defined(__sgi) #if !defined(sgi) && !defined(__sgi)
if (!ioctl (pty_slave, I_FIND, "ttcompat")) if (!ioctl (pty_slave, I_FIND, "ttcompat"))
if (ioctl (pty_slave, I_PUSH, "ttcompat") == -1) if (ioctl (pty_slave, I_PUSH, "ttcompat") == -1) {
{ fprintf (stderr,
fprintf (stderr, "ioctl (pty_slave, I_PUSH, \"ttcompat\") failed\n"); "ioctl (%s, I_PUSH, \"ttcompat\") failed: %s\r\n",
pty_slave, unix_error_string (errno));
close (pty_slave); close (pty_slave);
return -1; return -1;
} }
@ -1130,20 +1139,20 @@ static int pty_open_master (char *pty_name)
} }
/* BSD version of pty_open_slave */ /* BSD version of pty_open_slave */
static int pty_open_slave (const char *pty_name) static int
pty_open_slave (const char *pty_name)
{ {
int pty_slave; int pty_slave;
struct group *group_info = getgrnam ("tty"); struct group *group_info = getgrnam ("tty");
if (group_info != NULL) if (group_info != NULL) {
{
/* The following two calls will only succeed if we are root */ /* The following two calls will only succeed if we are root */
/* [Commented out while permissions problem is investigated] */ /* [Commented out while permissions problem is investigated] */
/* chown (pty_name, getuid (), group_info->gr_gid); FIXME */ /* chown (pty_name, getuid (), group_info->gr_gid); FIXME */
/* chmod (pty_name, S_IRUSR | S_IWUSR | S_IWGRP); FIXME */ /* chmod (pty_name, S_IRUSR | S_IWUSR | S_IWGRP); FIXME */
} }
if ((pty_slave = open (pty_name, O_RDWR)) == -1) if ((pty_slave = open (pty_name, O_RDWR)) == -1)
perror ("open (pty_name, O_RDWR)"); fprintf (stderr, "open (pty_name, O_RDWR): %s\r\n", pty_name);
return pty_slave; return pty_slave;
} }