summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/h5ls/h5ls.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index 2c3bfd8..567238e 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -1724,13 +1724,22 @@ datatype_list2(hid_t type, const char UNUSED *name)
static hid_t
slink_open(hid_t location, const char *name)
{
- char buf[64];
+ H5G_stat_t statbuf;
- if(H5Lget_val(location, name, buf, sizeof(buf), H5P_DEFAULT) < 0)
+ if (H5Gget_objinfo(location, name, FALSE, &statbuf) < 0)
return -1;
- if(NULL == HDmemchr(buf, 0, sizeof(buf)))
- HDstrcpy(buf + sizeof(buf) - 4, "...");
- HDfputs(buf, stdout);
+
+ if(statbuf.type == H5G_LINK) { /* Soft link */
+ char *buf = HDmalloc(statbuf.linklen);
+
+ if(H5Lget_val(location, name, buf, statbuf.linklen, H5P_DEFAULT) < 0) {
+ HDfree(buf);
+ return -1;
+ }
+
+ HDfputs(buf, stdout);
+ HDfree(buf);
+ }
return 0;
}