mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 17:23:56 -06:00
tests/9p: Test Tsetattr
can truncate unlinked file
Enhance the `use-after-unlink` test with a new check for the case where the client wants to alter the size of an unlinked file for which it still has an active fid. Suggested-by: Christian Schoenebeck <qemu_oss@crudebyte.com> Signed-off-by: Greg Kurz <groug@kaod.org> Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com> Message-Id: <20250312152933.383967-7-groug@kaod.org> Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
This commit is contained in:
parent
4719a2d591
commit
610dc187e5
1 changed files with 14 additions and 0 deletions
|
@ -736,6 +736,20 @@ static void fs_use_after_unlink(void *obj, void *data,
|
|||
.data = buf
|
||||
}).count;
|
||||
g_assert_cmpint(count, ==, write_count);
|
||||
|
||||
/* truncate file to (arbitrarily chosen) size 2001 */
|
||||
tsetattr({
|
||||
.client = v9p, .fid = fid_file, .attr = (v9fs_attr) {
|
||||
.valid = P9_SETATTR_SIZE,
|
||||
.size = 2001
|
||||
}
|
||||
});
|
||||
/* truncate apparently succeeded, let's double-check the size */
|
||||
tgetattr({
|
||||
.client = v9p, .fid = fid_file, .request_mask = P9_GETATTR_BASIC,
|
||||
.rgetattr.attr = &attr
|
||||
});
|
||||
g_assert_cmpint(attr.size, ==, 2001);
|
||||
}
|
||||
|
||||
static void cleanup_9p_local_driver(void *data)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue