Index: pseudotty.c =================================================================== --- pseudotty.c (revision 6285) +++ pseudotty.c (working copy) @@ -33,15 +33,13 @@ #include #include -#define CONTROL 3 - /* Used by "error" function. */ const char *program_name = "pseudotty"; int -main (void) +main (int argc, char *argv[]) { - int master; + int master, control; char *name; fd_set read_set; @@ -62,21 +60,25 @@ int printf ("%s\n", name); if (fclose (stdout) != 0) - { - error (1, 0, "error closing stdout: aborting"); - } + error (1, 0, "error closing stdout: aborting"); + error (0, 0, "opening control channel"); + control = open (argv[1], O_RDONLY); + if (control == -1) + error (1, 0, "error opening control channel: aborting"); + + FD_ZERO (&read_set); error (0, 0, "entering main loop"); while (1) { FD_SET (master, &read_set); - FD_SET (CONTROL, &read_set); + FD_SET (control, &read_set); select (FD_SETSIZE, &read_set, 0, 0, 0); - if (FD_ISSET (CONTROL, &read_set)) + if (FD_ISSET (control, &read_set)) { char c; int success; @@ -84,7 +86,7 @@ int while (1) { error (0, 0, "trying to read"); - success = read (CONTROL, &c, 1); + success = read (control, &c, 1); if (success < 0) { if (errno != EINTR) Index: t/Init-inter.inc =================================================================== --- t/Init-inter.inc (revision 6278) +++ t/Init-inter.inc (working copy) @@ -86,13 +86,13 @@ fi # background process instead. # Wedge open pipe -sleep 10 3>$PTY_TYPE & -WEDGE_PTY_PID=$! +#sleep 10 3>$PTY_TYPE & +#WEDGE_PTY_PID=$! # Also keep the pipe open for reading in case pseudotty exits, so that # trying to open the pipe for writing doesn't hang. -sleep 10 3<$PTY_TYPE & -WEDGE_PTY_PID2=$! +#sleep 10 3<$PTY_TYPE & +#WEDGE_PTY_PID2=$! # If we wanted the process to be open indefinitely, we could use an # infinite loop in a subshell, like: @@ -106,12 +106,14 @@ fi # cat 3>$PTY_TYPE $PIPEIN 3<$PTY_TYPE & +#./pseudotty >$PIPEIN 3<$PTY_TYPE & +./pseudotty "$PTY_TYPE" >$PIPEIN & PTY_PID=$! - # Get name of pseudo-terminal slave device read PTS_DEVICE <$PIPEIN +exec 7>$PTY_TYPE + # glibc can kill a running process if it detects a condition like a # double free. This specifies that the message it prints when it does # this should be sent to stderr so it can be recorded in the test *.log