Close some file descriptors on exec so that the inferior process gets

a normal environment.  Fd's 3 and 4 were usually left open.
This commit is contained in:
Bruce Evans 1997-12-17 13:23:51 +00:00
parent bd29cad15f
commit 27c62c22c7
2 changed files with 2 additions and 0 deletions

View File

@ -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)

View File

@ -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(). */