From f5c5a4e915e5344ee92ed23a07db1033e1144914 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 23 Mar 2002 16:14:28 +0000 Subject: name-finder.h (_Jv_name_finder::myclose): New method. * include/name-finder.h (_Jv_name_finder::myclose): New method. * name-finder.cc (_Jv_name_finder): Initialize file descriptors. From-SVN: r51234 --- libjava/include/Makefile.in | 11 ++++++----- libjava/include/name-finder.h | 27 +++++++++++++++++++++------ 2 files changed, 27 insertions(+), 11 deletions(-) (limited to 'libjava/include') diff --git a/libjava/include/Makefile.in b/libjava/include/Makefile.in index acc32e8..2f36f99 100644 --- a/libjava/include/Makefile.in +++ b/libjava/include/Makefile.in @@ -1,6 +1,6 @@ -# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am +# Makefile.in generated automatically by automake 1.4 from Makefile.am -# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -80,6 +80,7 @@ GCDEPS = @GCDEPS@ GCINCS = @GCINCS@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ +GCJVERSION = @GCJVERSION@ GCLIBS = @GCLIBS@ GCOBJS = @GCOBJS@ GCSPEC = @GCSPEC@ @@ -109,13 +110,13 @@ RANLIB = @RANLIB@ STRIP = @STRIP@ SYSDEP_SOURCES = @SYSDEP_SOURCES@ SYSTEMSPEC = @SYSTEMSPEC@ +SYS_ZLIBS = @SYS_ZLIBS@ THREADDEPS = @THREADDEPS@ THREADINCS = @THREADINCS@ THREADLIBS = @THREADLIBS@ THREADOBJS = @THREADOBJS@ THREADSPEC = @THREADSPEC@ VERSION = @VERSION@ -ZDEPS = @ZDEPS@ ZINCS = @ZINCS@ ZLIBS = @ZLIBS@ ZLIBSPEC = @ZLIBSPEC@ @@ -138,7 +139,7 @@ DIST_COMMON = ./stamp-h1.in Makefile.am Makefile.in config.h.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = gtar +TAR = tar GZIP_ENV = --best all: all-redirect .SUFFIXES: @@ -235,7 +236,7 @@ distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ + cp -pr $$/$$file $(distdir)/$$file; \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ diff --git a/libjava/include/name-finder.h b/libjava/include/name-finder.h index 46ae20a..805725b 100644 --- a/libjava/include/name-finder.h +++ b/libjava/include/name-finder.h @@ -40,12 +40,19 @@ public: ~_Jv_name_finder () { #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); + myclose (f_pipe[0]); + myclose (f_pipe[1]); + myclose (b_pipe[0]); + myclose (b_pipe[1]); + if (b_pipe_fd != NULL) + fclose (b_pipe_fd); + + if (pid >= 0) + { + int wstat; + // We don't care about errors here. + waitpid (pid, &wstat, 0); + } #endif } @@ -72,5 +79,13 @@ private: int f_pipe[2], b_pipe[2]; FILE *b_pipe_fd; int error; + + // Close a descriptor only if it has not been closed. + void myclose (int fd) + { + if (fd != -1) + close (fd); + } + #endif }; -- cgit v1.1