diff --git a/core/org.eclipse.cdt.core.solaris/library/exec_pty.c b/core/org.eclipse.cdt.core.solaris/library/exec_pty.c index d012cfb051c..f2a9996582a 100644 --- a/core/org.eclipse.cdt.core.solaris/library/exec_pty.c +++ b/core/org.eclipse.cdt.core.solaris/library/exec_pty.c @@ -7,6 +7,8 @@ #include #include #include +#include +#include /* from pfind.c */ extern char *pfind(const char *name); @@ -71,7 +73,7 @@ exec_pty(const char *path, char *const argv[], char *const envp[], dup2(fds, STDIN_FILENO); /* dup stdin */ dup2(fds, STDOUT_FILENO); /* dup stdout */ dup2(pipe2[1], STDERR_FILENO); /* dup stderr */ - close(fds); /* done with fds. */ + close(fds); /* done with fds. */ } /* Close all the fd's in the child */ @@ -93,6 +95,7 @@ exec_pty(const char *path, char *const argv[], char *const envp[], } else if (childpid != 0) { /* parent */ + ioctl(fdm, I_PUSH, "ptem"); set_noecho(fdm); if (channels != NULL) { /* close the write end of pipe1 */ @@ -127,14 +130,21 @@ int main(int argc, char **argv, char **envp) { fdm = ptym_open(pts_name); status = exec_pty(path, argv, envp, ".", channels, pts_name, fdm); if (status >= 0) { - app_stdin = fdopen(channels[0], "w"); + //app_stdin = fdopen(channels[0], "w"); app_stdout = fdopen(channels[1], "r"); app_stderr = fdopen(channels[2], "r"); - if (app_stdout == NULL || app_stderr == NULL || app_stdin == NULL) { + if (app_stdout == NULL || app_stderr == NULL /*|| app_stdin == NULL*/) { fprintf(stderr, "PROBLEMS\n"); } else { - fputs("foo\n", app_stdin); - fputs("bar\n", app_stdin); + printf("PID %d\n", status); + if (isatty(fdm)) { + printf("Is atty\n"); + } + write(fdm, "foo\n", 4); + write(fdm, "bar\n", 4); + //fputs("foo\n", app_stdin); + //fputs("bar\n", app_stdin); + //fflush(app_stdin); while(fgets(buffer, sizeof buffer, app_stdout) != NULL) { fprintf(stdout, "STDOUT: %s\n", buffer); } diff --git a/core/org.eclipse.cdt.core.solaris/library/exec_unix.c b/core/org.eclipse.cdt.core.solaris/library/exec_unix.c index 3c3db7926b0..9e4ef1b274f 100644 --- a/core/org.eclipse.cdt.core.solaris/library/exec_unix.c +++ b/core/org.eclipse.cdt.core.solaris/library/exec_unix.c @@ -90,8 +90,6 @@ exec0(const char *path, char *const argv[], char *const envp[], } else if (childpid != 0) { /* parent */ - char b; - if (channels != NULL) { /* close the read end of pipe1 */ if (close(pipe0[0]) == -1) diff --git a/core/org.eclipse.cdt.core.solaris/library/openpty.c b/core/org.eclipse.cdt.core.solaris/library/openpty.c index 8fe4fe260af..3d8e822776c 100644 --- a/core/org.eclipse.cdt.core.solaris/library/openpty.c +++ b/core/org.eclipse.cdt.core.solaris/library/openpty.c @@ -60,8 +60,6 @@ ptym_open(char * pts_name) strcpy(pts_name, "/dev/ptmx"); fdm = open(pts_name, O_RDWR); - if (fdm < 0) - return -1; if (fdm < 0) return -1; if (grantpt(fdm) < 0) { /* grant access to slave */ @@ -91,6 +89,7 @@ ptys_open(int fdm, char * pts_name) close(fdm); return -5; } + if (ioctl(fds, I_PUSH, "ptem") < 0) { printf("pterm:%s\n", strerror(errno)); close(fdm); diff --git a/core/org.eclipse.cdt.core.solaris/os/solaris/sparc/libpty.so b/core/org.eclipse.cdt.core.solaris/os/solaris/sparc/libpty.so index 33ba3c70d63..a5d848d0c57 100644 Binary files a/core/org.eclipse.cdt.core.solaris/os/solaris/sparc/libpty.so and b/core/org.eclipse.cdt.core.solaris/os/solaris/sparc/libpty.so differ diff --git a/core/org.eclipse.cdt.core.solaris/os/solaris/sparc/libspawner.so b/core/org.eclipse.cdt.core.solaris/os/solaris/sparc/libspawner.so index 70f2acab3c1..2d9da5cc8d3 100644 Binary files a/core/org.eclipse.cdt.core.solaris/os/solaris/sparc/libspawner.so and b/core/org.eclipse.cdt.core.solaris/os/solaris/sparc/libspawner.so differ