mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-31 13:07:46 +00:00
truncate: remove read permissions from OpenOptions
Remove "read" permissions from the `OpenOptions` when opening a new file just to truncate it. We will never read from the file, only write to it. (Specifically, we will only call `File::set_len()`.)
This commit is contained in:
parent
4e73b919e9
commit
b898e54d7a
1 changed files with 1 additions and 6 deletions
|
@ -189,12 +189,7 @@ fn truncate(
|
||||||
};
|
};
|
||||||
for filename in &filenames {
|
for filename in &filenames {
|
||||||
let path = Path::new(filename);
|
let path = Path::new(filename);
|
||||||
match OpenOptions::new()
|
match OpenOptions::new().write(true).create(!no_create).open(path) {
|
||||||
.read(true)
|
|
||||||
.write(true)
|
|
||||||
.create(!no_create)
|
|
||||||
.open(path)
|
|
||||||
{
|
|
||||||
Ok(file) => {
|
Ok(file) => {
|
||||||
let fsize = match reference {
|
let fsize = match reference {
|
||||||
Some(_) => refsize,
|
Some(_) => refsize,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue