Previously, ext2fs_extent_open2() copied the passed-in inode structure
into the extent handle, and the extent functions modified the copy of
the inode structure if necessary due to extent splits, etc. Change
ext2fs_extent_open2() so that the extent functions use the inode
structure passed into ext2fs_extent_open2(). Otherwise the passed-in
inode structure could become out of date due to changes made by the
extent functions.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
ext2_filsys fs;
ext2_ino_t ino;
struct ext2_inode *inode;
+ struct ext2_inode inodebuf;
int type;
int level;
int max_depth;
if (!handle)
return;
- if (handle->inode)
- ext2fs_free_mem(&handle->inode);
if (handle->path) {
for (i=1; i <= handle->max_depth; i++) {
if (handle->path[i].buf)
return retval;
memset(handle, 0, sizeof(struct ext2_extent_handle));
- retval = ext2fs_get_mem(sizeof(struct ext2_inode), &handle->inode);
- if (retval)
- goto errout;
-
handle->ino = ino;
handle->fs = fs;
if (inode) {
- memcpy(handle->inode, inode, sizeof(struct ext2_inode));
- }
- else {
+ handle->inode = inode;
+ } else {
+ handle->inode = &handle->inodebuf;
retval = ext2fs_read_inode(fs, ino, handle->inode);
if (retval)
goto errout;