mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07: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:
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user