From efc70584784ba96f40bc702aea0810a45dcebe66 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 30 May 2000 23:26:02 +0000 Subject: name-finder.h: Include . * include/name-finder.h: Include . (_Jv_name_finder::pid): Now of type `pid_t'. (_Jv_name_finder::~_Jv_name_finder): Call waitpid(). * java/lang/Throwable.java (CPlusPlusDemangler.close): Call `proc.waitFor()'. From-SVN: r34279 --- libjava/ChangeLog | 8 ++++++++ libjava/include/name-finder.h | 10 +++++++--- libjava/java/lang/Throwable.java | 7 +++++++ libjava/name-finder.cc | 8 ++++---- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 165b56d..1361abe 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,11 @@ +2000-05-30 Tom Tromey + + * include/name-finder.h: Include . + (_Jv_name_finder::pid): Now of type `pid_t'. + (_Jv_name_finder::~_Jv_name_finder): Call waitpid(). + * java/lang/Throwable.java (CPlusPlusDemangler.close): Call + `proc.waitFor()'. + 2000-05-24 Warren Levy * java/io/ObjectOutputStream.java (writeObject): Use component type diff --git a/libjava/include/name-finder.h b/libjava/include/name-finder.h index 9a1d7df..2d2ab9f 100644 --- a/libjava/include/name-finder.h +++ b/libjava/include/name-finder.h @@ -17,6 +17,7 @@ details. */ #include #include +#include #include #include @@ -38,8 +39,12 @@ public: #if defined (HAVE_PIPE) && defined (HAVE_FORK) close (f_pipe[1]); fclose (b_pipe_fd); + + int wstat; + // We don't care about errors here. + waitpid (pid, &wstat, 0); #endif - } + } /* Given a pointer to a function or method, try to convert it into a name and the appropriate line and source file. The caller passes @@ -60,10 +65,9 @@ public: private: void toHex (void *p); #if defined (HAVE_PIPE) && defined (HAVE_FORK) - int pid; + pid_t pid; int f_pipe[2], b_pipe[2]; FILE *b_pipe_fd; int error; #endif }; - diff --git a/libjava/java/lang/Throwable.java b/libjava/java/lang/Throwable.java index 9892dd2..db57deb 100644 --- a/libjava/java/lang/Throwable.java +++ b/libjava/java/lang/Throwable.java @@ -88,6 +88,13 @@ class CPlusPlusDemangler extends OutputStream written++; } p.flush (); + try + { + proc.waitFor (); + } + catch (InterruptedException _) + { + } } } diff --git a/libjava/name-finder.cc b/libjava/name-finder.cc index ab028af..0085793 100644 --- a/libjava/name-finder.cc +++ b/libjava/name-finder.cc @@ -78,7 +78,7 @@ _Jv_name_finder::_Jv_name_finder (char *executable) error |= pipe (f_pipe) < 0; error |= pipe (b_pipe) < 0; - + if (error) return; @@ -92,16 +92,16 @@ _Jv_name_finder::_Jv_name_finder (char *executable) execvp (argv[0], argv); _exit (127); } - + close (f_pipe [0]); close (b_pipe [1]); - + if (pid < 0) { error |= 1; return; } - + b_pipe_fd = fdopen (b_pipe[0], "r"); error |= !b_pipe_fd; #endif -- cgit v1.1