trim(8): candelete() returns wrong results because fd is opened O_WRONLY

This was discovered while using trim(8) to test bhyve trim

Reviewed by:	asomers
Differential Revision:	https://reviews.freebsd.org/D24371
This commit is contained in:
Allan Jude 2020-04-23 20:14:59 +00:00
parent 22769bbe30
commit 9d433cb875

View File

@ -220,7 +220,7 @@ trim(const char *path, off_t offset, off_t length, bool dryrun, bool verbose)
return (0);
}
fd = opendev(path, O_WRONLY | O_DIRECT);
fd = opendev(path, O_RDWR | O_DIRECT);
arg[0] = offset;
arg[1] = length;