diff options
Diffstat (limited to 'libctf/ctf-types.c')
-rw-r--r-- | libctf/ctf-types.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/libctf/ctf-types.c b/libctf/ctf-types.c index dd82053..c20ff82 100644 --- a/libctf/ctf-types.c +++ b/libctf/ctf-types.c @@ -177,7 +177,7 @@ ctf_member_next (ctf_dict_t *fp, ctf_id_t type, ctf_next_t **it, if (ctf_struct_member (fp, &memb, i->ctn_tp, i->u.ctn_vlen, i->ctn_size, i->ctn_n) < 0) - return -1; /* errno is set for us. */ + return (ctf_set_errno (ofp, ctf_errno (fp))); membname = ctf_strptr (fp, memb.ctlm_name); @@ -216,11 +216,12 @@ ctf_member_next (ctf_dict_t *fp, ctf_id_t type, ctf_next_t **it, ctf_next_destroy (i); *it = NULL; i->ctn_type = 0; - return ret; /* errno is set for us. */ + ctf_set_errno (ofp, ctf_errno (fp)); + return ret; } if (!ctf_assert (fp, (i->ctn_next == NULL))) - return -1; /* errno is set for us. */ + return (ctf_set_errno (ofp, ctf_errno (fp))); i->ctn_type = 0; /* This sub-struct has ended: on to the next real member. */ @@ -597,6 +598,7 @@ ctf_type_resolve (ctf_dict_t *fp, ctf_id_t type) ctf_id_t ctf_type_resolve_unsliced (ctf_dict_t *fp, ctf_id_t type) { + ctf_dict_t *ofp = fp; const ctf_type_t *tp; if ((type = ctf_type_resolve (fp, type)) == CTF_ERR) @@ -606,7 +608,13 @@ ctf_type_resolve_unsliced (ctf_dict_t *fp, ctf_id_t type) return CTF_ERR; /* errno is set for us. */ if ((LCTF_INFO_KIND (fp, tp->ctt_info)) == CTF_K_SLICE) - return ctf_type_reference (fp, type); + { + ctf_id_t ret; + + if ((ret = ctf_type_reference (fp, type)) == CTF_ERR) + return (ctf_set_errno (ofp, ctf_errno (fp))); + return ret; + } return type; } @@ -767,6 +775,7 @@ ctf_type_aname (ctf_dict_t *fp, ctf_id_t type) break; err: + ctf_set_errno (fp, ctf_errno (rfp)); free (argv); ctf_decl_fini (&cd); return NULL; @@ -1216,8 +1225,8 @@ ctf_type_encoding (ctf_dict_t *fp, ctf_id_t type, ctf_encoding_t *ep) ctf_id_t underlying; slice = (ctf_slice_t *) vlen; - underlying = ctf_type_resolve (fp, slice->cts_type); - if (ctf_type_encoding (fp, underlying, &underlying_en) < 0) + underlying = ctf_type_resolve (ofp, slice->cts_type); + if (ctf_type_encoding (ofp, underlying, &underlying_en) < 0) return -1; /* errno is set for us. */ ep->cte_format = underlying_en.cte_format; @@ -1409,7 +1418,7 @@ ctf_member_info (ctf_dict_t *fp, ctf_id_t type, const char *name, const char *membname; if (ctf_struct_member (fp, &memb, tp, vlen, vbytes, i) < 0) - return -1; /* errno is set for us. */ + return (ctf_set_errno (ofp, ctf_errno (fp))); membname = ctf_strptr (fp, memb.ctlm_name); @@ -1558,6 +1567,7 @@ ctf_enum_value (ctf_dict_t *fp, ctf_id_t type, const char *name, int *valp) int ctf_func_type_info (ctf_dict_t *fp, ctf_id_t type, ctf_funcinfo_t *fip) { + ctf_dict_t *ofp = fp; const ctf_type_t *tp; uint32_t kind; const uint32_t *args; @@ -1574,7 +1584,7 @@ ctf_func_type_info (ctf_dict_t *fp, ctf_id_t type, ctf_funcinfo_t *fip) kind = LCTF_INFO_KIND (fp, tp->ctt_info); if (kind != CTF_K_FUNCTION) - return (ctf_set_errno (fp, ECTF_NOTFUNC)); + return (ctf_set_errno (ofp, ECTF_NOTFUNC)); fip->ctc_return = tp->ctt_type; fip->ctc_flags = 0; @@ -1638,6 +1648,7 @@ static int ctf_type_rvisit (ctf_dict_t *fp, ctf_id_t type, ctf_visit_f *func, void *arg, const char *name, unsigned long offset, int depth) { + ctf_dict_t *ofp = fp; ctf_id_t otype = type; const ctf_type_t *tp; const ctf_dtdef_t *dtd; @@ -1686,7 +1697,7 @@ ctf_type_rvisit (ctf_dict_t *fp, ctf_id_t type, ctf_visit_f *func, ctf_lmember_t memb; if (ctf_struct_member (fp, &memb, tp, vlen, vbytes, i) < 0) - return -1; /* errno is set for us. */ + return (ctf_set_errno (ofp, ctf_errno (fp))); if ((rc = ctf_type_rvisit (fp, memb.ctlm_type, func, arg, ctf_strptr (fp, memb.ctlm_name), |