find_and_open_source (const char *filename,
const char *dirname,
gdb::unique_xmalloc_ptr<char> *fullname)
find_and_open_source (const char *filename,
const char *dirname,
gdb::unique_xmalloc_ptr<char> *fullname)
if (!(flags & PRINT_SOURCE_LINES_NOERROR))
{
const char *filename = symtab_to_filename_for_display (s);
if (!(flags & PRINT_SOURCE_LINES_NOERROR))
{
const char *filename = symtab_to_filename_for_display (s);
- {
- close (desc);
- error (_("Line number %d out of range; %s has %d lines."),
- line, symtab_to_filename_for_display (s), s->nlines);
- }
+ error (_("Line number %d out of range; %s has %d lines."),
+ line, symtab_to_filename_for_display (s), s->nlines);
- if (lseek (desc, s->line_charpos[line - 1], 0) < 0)
- {
- close (desc);
- perror_with_name (symtab_to_filename_for_display (s));
- }
+ if (lseek (desc.get (), s->line_charpos[line - 1], 0) < 0)
+ perror_with_name (symtab_to_filename_for_display (s));