Skip to content

Commit

Permalink
Fix dt_print_visit() to compile also on OL7
Browse files Browse the repository at this point in the history
Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
Reviewed-by: Alan Maguire <alan.maguire@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
  • Loading branch information
euloh authored and kvanhees committed Jan 30, 2024
1 parent 7e159ef commit aeac9ac
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions libdtrace/dt_printf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1979,7 +1979,7 @@ dt_print_visit(const char *name, ctf_id_t type, unsigned long offset,
const void *data = (char *)dva->dv_data + offset/NBBY;
const char *membername = NULL;
ssize_t typesize, asize = 0;
char *typename = NULL;
char typename[DT_TYPE_NAMELEN];
char *datastr = NULL;
int64_t intdata = 0;
const char *ename;
Expand All @@ -1998,8 +1998,7 @@ dt_print_visit(const char *name, ctf_id_t type, unsigned long offset,
dva->dv_startindent + depth, "");
return -1;
}
typename = ctf_type_aname(dva->dv_ctfp, type);
if (!typename) {
if (ctf_type_name(dva->dv_ctfp, type, typename, sizeof(typename)) == NULL) {
dt_dprintf("error retrieving type name for [%ld]: %s\n",
type, ctf_errmsg(ctf_errno(dva->dv_ctfp)));
return dt_set_errno(dva->dv_dtp, EDT_CTF);
Expand Down Expand Up @@ -2164,7 +2163,6 @@ dt_print_visit(const char *name, ctf_id_t type, unsigned long offset,
typename, (uintptr_t)*(void **)data);
break;
default:
free(typename);
return 0;
}
doprint:
Expand All @@ -2173,7 +2171,6 @@ dt_print_visit(const char *name, ctf_id_t type, unsigned long offset,
ret = dt_set_errno(dva->dv_dtp, EDT_NOMEM);
goto err;
}
free(typename);

/* format is
* [.<membername> = ](<type>)value,
Expand Down Expand Up @@ -2231,7 +2228,6 @@ dt_print_visit(const char *name, ctf_id_t type, unsigned long offset,
}
return 0;
err:
free(typename);
free(datastr);
return ret;
}
Expand Down

0 comments on commit aeac9ac

Please sign in to comment.