summaryrefslogtreecommitdiffstats
path: root/src/H5G.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-08-14 21:05:16 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-08-14 21:05:16 (GMT)
commit25b825965ed5910a3d0c7b98db3bc183e57a499a (patch)
treeddebdb78d0c226d3891bc8428e048bb8768bca97 /src/H5G.c
parenta7e57b27793e548d7c0cf374f0b986f06e2cce13 (diff)
downloadhdf5-25b825965ed5910a3d0c7b98db3bc183e57a499a.zip
hdf5-25b825965ed5910a3d0c7b98db3bc183e57a499a.tar.gz
hdf5-25b825965ed5910a3d0c7b98db3bc183e57a499a.tar.bz2
[svn-r594] Changes since 19980813
---------------------- ./src/H5G.c ./src/H5Gpublic.h ./test/links.c Fixed a bug in H5Gstat() that caused the wrong information to be returned sometimes. Added check for named data types. ./test/extend.c ./test/links.c ./test/mtime.c Added `all tests passed' messages.
Diffstat (limited to 'src/H5G.c')
-rw-r--r--src/H5G.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/H5G.c b/src/H5G.c
index 1bb00ef..77bf223 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -1961,6 +1961,7 @@ H5G_stat (H5G_t *loc, const char *name, hbool_t follow_link,
const char *s = NULL;
H5D_t *temp_dset = NULL;
H5G_t *temp_grp = NULL;
+ H5T_t *temp_type = NULL;
FUNC_ENTER (H5G_stat, FAIL);
@@ -1980,7 +1981,22 @@ H5G_stat (H5G_t *loc, const char *name, hbool_t follow_link,
* length is specific to symbolic links.
*/
if (statbuf) {
- if (H5G_CACHED_SLINK!=obj_ent.type) {
+ if (H5G_CACHED_SLINK==obj_ent.type) {
+ /* Named object is a symbolic link */
+ if (NULL==H5O_read (&grp_ent, H5O_STAB, 0, &stab_mesg) ||
+ NULL==(s=H5HL_peek (grp_ent.file, &(stab_mesg.heap_addr),
+ obj_ent.cache.slink.lval_offset))) {
+ HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL,
+ "unable to read symbolic link value");
+ }
+ statbuf->linklen = strlen(s)+1; /*count the null terminator*/
+ statbuf->objno[0] = statbuf->objno[1] = 0;
+ statbuf->nlink = 0;
+ statbuf->type = H5G_LINK;
+ statbuf->mtime = 0;
+
+ } else {
+ /* Some other type of object */
statbuf->objno[0] = (unsigned long)(obj_ent.header.offset);
if (sizeof(obj_ent.header.offset)>sizeof(long)) {
statbuf->objno[1] = (unsigned long)(obj_ent.header.offset >>
@@ -1992,14 +2008,6 @@ H5G_stat (H5G_t *loc, const char *name, hbool_t follow_link,
H5E_clear();
statbuf->mtime = 0;
}
- } else {
- if (NULL==H5O_read (&grp_ent, H5O_STAB, 0, &stab_mesg) ||
- NULL==(s=H5HL_peek (grp_ent.file, &(stab_mesg.heap_addr),
- obj_ent.cache.slink.lval_offset))) {
- HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL,
- "unable to read symbolic link value");
- }
- statbuf->linklen = strlen(s)+1; /*count the null terminator*/
/*
* Determining the type of an object is a rather expensive
@@ -2012,6 +2020,9 @@ H5G_stat (H5G_t *loc, const char *name, hbool_t follow_link,
} else if (NULL!=(temp_grp=H5G_open (loc, name))) {
statbuf->type = H5G_GROUP;
H5G_close (temp_grp);
+ } else if (NULL!=(temp_type=H5T_open(loc, name))) {
+ statbuf->type = H5G_TYPE;
+ H5T_close(temp_type);
} else {
statbuf->type = H5G_UNKNOWN;
}