Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
libbacktrace
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
libbacktrace
Commits
17794037
Commit
17794037
authored
Jan 31, 2018
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* elf.c (elf_add): Close descriptor if we use a debugfile.
* btest.c (check_open_files): New static function. (main): Call check_open_files.
parent
811741b0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
4 deletions
+40
-4
btest.c
btest.c
+22
-0
elf.c
elf.c
+18
-4
No files found.
btest.c
View file @
17794037
...
...
@@ -37,6 +37,7 @@ POSSIBILITY OF SUCH DAMAGE. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "filenames.h"
...
...
@@ -456,6 +457,25 @@ test5 (void)
return
failures
;
}
/* Check that are no files left open. */
static
void
check_open_files
(
void
)
{
int
i
;
for
(
i
=
3
;
i
<
10
;
i
++
)
{
if
(
close
(
i
)
==
0
)
{
fprintf
(
stderr
,
"ERROR: descriptor %d still open after tests complete
\n
"
,
i
);
++
failures
;
}
}
}
/* Run all the tests. */
int
...
...
@@ -474,5 +494,7 @@ main (int argc ATTRIBUTE_UNUSED, char **argv)
#endif
#endif
check_open_files
();
exit
(
failures
?
EXIT_FAILURE
:
EXIT_SUCCESS
);
}
elf.c
View file @
17794037
...
...
@@ -2929,12 +2929,19 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
error_callback
,
data
);
if
(
d
>=
0
)
{
int
ret
;
backtrace_release_view
(
state
,
&
buildid_view
,
error_callback
,
data
);
if
(
debuglink_view_valid
)
backtrace_release_view
(
state
,
&
debuglink_view
,
error_callback
,
data
);
return
elf_add
(
state
,
NULL
,
d
,
base_address
,
error_callback
,
data
,
fileline_fn
,
found_sym
,
found_dwarf
,
0
,
1
);
ret
=
elf_add
(
state
,
NULL
,
d
,
base_address
,
error_callback
,
data
,
fileline_fn
,
found_sym
,
found_dwarf
,
0
,
1
);
if
(
ret
<
0
)
backtrace_close
(
d
,
error_callback
,
data
);
else
backtrace_close
(
descriptor
,
error_callback
,
data
);
return
ret
;
}
}
...
...
@@ -2953,10 +2960,17 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
data
);
if
(
d
>=
0
)
{
int
ret
;
backtrace_release_view
(
state
,
&
debuglink_view
,
error_callback
,
data
);
return
elf_add
(
state
,
NULL
,
d
,
base_address
,
error_callback
,
data
,
fileline_fn
,
found_sym
,
found_dwarf
,
0
,
1
);
ret
=
elf_add
(
state
,
NULL
,
d
,
base_address
,
error_callback
,
data
,
fileline_fn
,
found_sym
,
found_dwarf
,
0
,
1
);
if
(
ret
<
0
)
backtrace_close
(
d
,
error_callback
,
data
);
else
backtrace_close
(
descriptor
,
error_callback
,
data
);
return
ret
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment