mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-19 16:50:46 +08:00
[svn-r13366] Fix h5ls problem on long soft links.
This commit is contained in:
parent
1b98fd4dbe
commit
9deb5961ee
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user