aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libctf/ChangeLog5
-rw-r--r--libctf/ctf-create.c5
2 files changed, 9 insertions, 1 deletions
diff --git a/libctf/ChangeLog b/libctf/ChangeLog
index 056cb7b..7868d0b 100644
--- a/libctf/ChangeLog
+++ b/libctf/ChangeLog
@@ -1,5 +1,10 @@
2020-06-26 Nick Alcock <nick.alcock@oracle.com>
+ * ctf-create.c (ctf_add_forward): Don't add forwards to
+ types that already exist.
+
+2020-06-26 Nick Alcock <nick.alcock@oracle.com>
+
* ctf-open.c (init_types): Only intern root-visible types.
* ctf-create.c (ctf_dtd_insert): Likewise.
(ctf_dtd_delete): Only remove root-visible types.
diff --git a/libctf/ctf-create.c b/libctf/ctf-create.c
index e8e8028..c24a246 100644
--- a/libctf/ctf-create.c
+++ b/libctf/ctf-create.c
@@ -1229,7 +1229,10 @@ ctf_add_forward (ctf_file_t *fp, uint32_t flag, const char *name,
if (name != NULL)
type = ctf_lookup_by_rawname (fp, kind, name);
- if ((type = ctf_add_generic (fp, flag, name, CTF_K_FORWARD,&dtd)) == CTF_ERR)
+ if (type)
+ return type;
+
+ if ((type = ctf_add_generic (fp, flag, name, CTF_K_FORWARD, &dtd)) == CTF_ERR)
return CTF_ERR; /* errno is set for us. */
dtd->dtd_data.ctt_info = CTF_TYPE_INFO (CTF_K_FORWARD, flag, 0);