diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2009-03-24 21:32:50 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2009-03-24 21:32:50 (GMT) |
commit | 30ccff2212467bfb342b566752c41de94cd4bf85 (patch) | |
tree | e7acb5d993fe3b3bf9f2943615b7bcafd7cc4edf /src/H5Fsuper.c | |
parent | 9c9e2c6d7daae12fe44ffb1e66f2caaea65bc619 (diff) | |
download | hdf5-30ccff2212467bfb342b566752c41de94cd4bf85.zip hdf5-30ccff2212467bfb342b566752c41de94cd4bf85.tar.gz hdf5-30ccff2212467bfb342b566752c41de94cd4bf85.tar.bz2 |
[svn-r16608] Bug fix (#1161): When a family file created with v1.6 library is opened and closed with
v1.8 library, v1.8 library writes the driver info block in the superblock. But v1.6
doesn't write it. This caused the data after the superblock to be overwritten. The
solution is to use a flag to indicate when the original file doesn't have the driver
info, v1.8 library doesn't write it either.
Tested on jam. I have some trouble to access smirom and linew using h5committest.
Diffstat (limited to 'src/H5Fsuper.c')
-rw-r--r-- | src/H5Fsuper.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 70e0954..69c7a8d 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -466,6 +466,16 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc) if(H5FD_sb_decode(lf, drv_name, p) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to decode driver information") } /* end if */ + else + /* This flag is false only if a file was created with v1.6 library or + * before and no driver info was saved in the superblock. When the file is + * closed and superblock is written to the file, v1.8 library or after + * doesn't write the driver info in the superblock. Otherwise, the newly + * added driver block will overwrite the (meta)data right after the + * superblock. SLU - 2009/3/24 + */ + shared->write_driver = FALSE; + } /* end if */ else { haddr_t root_addr; /* Address of root group */ @@ -934,7 +944,7 @@ H5F_super_write(H5F_t *f, hid_t dxpl_id) /* Encode the driver information block. */ H5_ASSIGN_OVERFLOW(driver_size, H5FD_sb_size(f->shared->lf), hsize_t, size_t); - if(driver_size > 0) { + if(driver_size > 0 && f->shared->write_driver) { char driver_name[9]; /* Name of driver, for driver info block */ uint8_t *dbuf = p; /* Pointer to beginning of driver info */ |