summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-04-26 21:52:52 -0600
committerTom Tromey <tom@tromey.com>2017-08-03 07:58:54 -0600
commit7cd06d6e89c9c17d358d8edf0b7faa9dd87edc3e (patch)
tree953845843565581454d43ae14874aec85295f7d5
parented1669453be56d71351c77377acee097aefe83b1 (diff)
downloadbinutils-gdb-7cd06d6e89c9c17d358d8edf0b7faa9dd87edc3e.tar.gz
Use gdb_file_up in fbsd-nat.c
This updates fbsd-nat.c to use gdb_file_up. This removes a use of a cleanup, and helps remove make_cleanup_fclose in a later patch. I have no way to test this patch. ChangeLog 2017-08-03 Tom Tromey <tom@tromey.com> * fbsd-nat.c (fbsd_find_memory_regions): Update.
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/fbsd-nat.c6
2 files changed, 6 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 80b9c2bbfc0..0431dc7ad45 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
2017-08-03 Tom Tromey <tom@tromey.com>
+ * fbsd-nat.c (fbsd_find_memory_regions): Update.
+
+2017-08-03 Tom Tromey <tom@tromey.com>
+
* cli/cli-cmds.c (find_and_open_script): Change return type.
Remove "streamp" and "full_path" parameters.
(source_script_with_search): Update.
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index 85f56059bdf..833f460237f 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -161,7 +161,6 @@ fbsd_find_memory_regions (struct target_ops *self,
{
pid_t pid = ptid_get_pid (inferior_ptid);
char *mapfilename;
- FILE *mapfile;
unsigned long start, end, size;
char protection[4];
int read, write, exec;
@@ -169,17 +168,16 @@ fbsd_find_memory_regions (struct target_ops *self,
mapfilename = xstrprintf ("/proc/%ld/map", (long) pid);
cleanup = make_cleanup (xfree, mapfilename);
- mapfile = fopen (mapfilename, "r");
+ gdb_file_up mapfile = fopen (mapfilename, "r");
if (mapfile == NULL)
error (_("Couldn't open %s."), mapfilename);
- make_cleanup_fclose (mapfile);
if (info_verbose)
fprintf_filtered (gdb_stdout,
"Reading memory regions from %s\n", mapfilename);
/* Now iterate until end-of-file. */
- while (fbsd_read_mapping (mapfile, &start, &end, &protection[0]))
+ while (fbsd_read_mapping (mapfile.get (), &start, &end, &protection[0]))
{
size = end - start;