summaryrefslogtreecommitdiff
path: root/libdw/dwarf_setalt.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdw/dwarf_setalt.c')
-rw-r--r--libdw/dwarf_setalt.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libdw/dwarf_setalt.c b/libdw/dwarf_setalt.c
index 9bd566ff..9051b8e0 100644
--- a/libdw/dwarf_setalt.c
+++ b/libdw/dwarf_setalt.c
@@ -1,5 +1,5 @@
/* Provides the data referenced by the .gnu_debugaltlink section.
- Copyright (C) 2014 Red Hat, Inc.
+ Copyright (C) 2014, 2018 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -32,9 +32,18 @@
#include "libdwP.h"
+#include <unistd.h>
+
void
dwarf_setalt (Dwarf *main, Dwarf *alt)
{
+ if (main->alt_fd != -1)
+ {
+ INTUSE(dwarf_end) (main->alt_dwarf);
+ close (main->alt_fd);
+ main->alt_fd = -1;
+ }
+
main->alt_dwarf = alt;
}
INTDEF (dwarf_setalt)