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.
This commit is contained in:
parent
ed1669453b
commit
7cd06d6e89
2 changed files with 6 additions and 4 deletions
|
@ -1,3 +1,7 @@
|
|||
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.
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue