aboutsummaryrefslogtreecommitdiff
path: root/gdb/exec.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2008-10-30 18:42:28 +0000
committerTom Tromey <tromey@redhat.com>2008-10-30 18:42:28 +0000
commit9fe4a2165de29f0802f0f9eb4801875e0f15c40a (patch)
tree57e0cbb83e955478f8ef776fdf63e64be3c4fc84 /gdb/exec.c
parentc22261528c50f7760dd6a2e29314662b377eebb4 (diff)
downloadgdb-9fe4a2165de29f0802f0f9eb4801875e0f15c40a.zip
gdb-9fe4a2165de29f0802f0f9eb4801875e0f15c40a.tar.gz
gdb-9fe4a2165de29f0802f0f9eb4801875e0f15c40a.tar.bz2
* source.c (symtab_to_fullname): Test 'r >= 0'.
(psymtab_to_fullname): Likewise. (get_filename_and_charpos): Make a cleanup. (forward_search_command): Likewise. (reverse_search_command): Likewise. * exec.c (exec_file_attach): Close scratch_chan on failure. * nto-procfs.c (procfs_open): Make a cleanup. (procfs_pidlist): Likewise. (do_closedir_cleanup): New function.
Diffstat (limited to 'gdb/exec.c')
-rw-r--r--gdb/exec.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gdb/exec.c b/gdb/exec.c
index 3b9ecfa..92450e6 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -217,8 +217,11 @@ exec_file_attach (char *filename, int from_tty)
scratch_chan);
if (!exec_bfd)
- error (_("\"%s\": could not open as an executable file: %s"),
- scratch_pathname, bfd_errmsg (bfd_get_error ()));
+ {
+ close (scratch_chan);
+ error (_("\"%s\": could not open as an executable file: %s"),
+ scratch_pathname, bfd_errmsg (bfd_get_error ()));
+ }
/* At this point, scratch_pathname and exec_bfd->name both point to the
same malloc'd string. However exec_close() will attempt to free it