aboutsummaryrefslogtreecommitdiff
path: root/gdb/nat/linux-btrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/nat/linux-btrace.c')
-rw-r--r--gdb/nat/linux-btrace.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/gdb/nat/linux-btrace.c b/gdb/nat/linux-btrace.c
index b2c84c1..1a383b7 100644
--- a/gdb/nat/linux-btrace.c
+++ b/gdb/nat/linux-btrace.c
@@ -204,24 +204,23 @@ linux_determine_kernel_start (void)
{
static uint64_t kernel_start;
static int cached;
- FILE *file;
if (cached != 0)
return kernel_start;
cached = 1;
- file = gdb_fopen_cloexec ("/proc/kallsyms", "r");
+ gdb_file_up file = gdb_fopen_cloexec ("/proc/kallsyms", "r");
if (file == NULL)
return kernel_start;
- while (!feof (file))
+ while (!feof (file.get ()))
{
char buffer[1024], symbol[8], *line;
uint64_t addr;
int match;
- line = fgets (buffer, sizeof (buffer), file);
+ line = fgets (buffer, sizeof (buffer), file.get ());
if (line == NULL)
break;
@@ -236,8 +235,6 @@ linux_determine_kernel_start (void)
}
}
- fclose (file);
-
return kernel_start;
}