mirror of
https://github.com/uutils/coreutils
synced 2024-11-17 02:08:09 +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
a746e37dc7
commit
5eb2a5c3e1
1 changed files with 1 additions and 6 deletions
|
@ -189,12 +189,7 @@ fn truncate(
|
|||
};
|
||||
for filename in &filenames {
|
||||
let path = Path::new(filename);
|
||||
match OpenOptions::new()
|
||||
.read(true)
|
||||
.write(true)
|
||||
.create(!no_create)
|
||||
.open(path)
|
||||
{
|
||||
match OpenOptions::new().write(true).create(!no_create).open(path) {
|
||||
Ok(file) => {
|
||||
let fsize = match reference {
|
||||
Some(_) => refsize,
|
||||
|
|
Loading…
Reference in a new issue