summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Cao <xcao@hdfgroup.org>2007-02-21 19:34:09 (GMT)
committerPeter Cao <xcao@hdfgroup.org>2007-02-21 19:34:09 (GMT)
commit9deb5961eeb5265c54df1a8a9daf0cea6c3cded6 (patch)
tree6d04a5541e122f53e510d39512916ea62488e596
parent1b98fd4dbe93ed371b026b02a0849375af64f4d5 (diff)
downloadhdf5-9deb5961eeb5265c54df1a8a9daf0cea6c3cded6.zip
hdf5-9deb5961eeb5265c54df1a8a9daf0cea6c3cded6.tar.gz
hdf5-9deb5961eeb5265c54df1a8a9daf0cea6c3cded6.tar.bz2
[svn-r13366] Fix h5ls problem on long soft links.
-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;
}