From a3800989c11caa7f22124276aee991f67f91098c Mon Sep 17 00:00:00 2001 From: bde Date: Wed, 17 Dec 1997 13:23:51 +0000 Subject: Close some file descriptors on exec so that the inferior process gets a normal environment. Fd's 3 and 4 were usually left open. --- contrib/gdb/gdb/exec.c | 1 + contrib/gdb/gdb/symfile.c | 1 + 2 files changed, 2 insertions(+) (limited to 'contrib/gdb') diff --git a/contrib/gdb/gdb/exec.c b/contrib/gdb/gdb/exec.c index dc71a49..4d3a307 100644 --- a/contrib/gdb/gdb/exec.c +++ b/contrib/gdb/gdb/exec.c @@ -185,6 +185,7 @@ exec_file_command (args, from_tty) &scratch_pathname); if (scratch_chan < 0) perror_with_name (filename); + fcntl (scratch_chan, F_SETFD, 1); exec_bfd = bfd_fdopenr (scratch_pathname, gnutarget, scratch_chan); if (!exec_bfd) diff --git a/contrib/gdb/gdb/symfile.c b/contrib/gdb/gdb/symfile.c index 62c4f61..4604678 100644 --- a/contrib/gdb/gdb/symfile.c +++ b/contrib/gdb/gdb/symfile.c @@ -820,6 +820,7 @@ symfile_bfd_open (name) make_cleanup (free, name); perror_with_name (name); } + fcntl (desc, F_SETFD, 1); free (name); /* Free 1st new malloc'd copy */ name = absolute_name; /* Keep 2nd malloc'd copy in bfd */ /* It'll be freed in free_objfile(). */ -- cgit v1.1