src/tools.rs - file_set_contents_full: only call fchmod when we pass permissions
So that we can use it to write into /etc/pve/ (which does not support chmod).
This commit is contained in:
parent
cec17a3ec7
commit
953d5e1531
|
@ -197,9 +197,11 @@ pub fn file_set_contents_full<P: AsRef<Path>>(
|
||||||
stat::Mode::S_IRGRP | stat::Mode::S_IROTH
|
stat::Mode::S_IRGRP | stat::Mode::S_IROTH
|
||||||
));
|
));
|
||||||
|
|
||||||
if let Err(err) = stat::fchmod(fd, mode) {
|
if perm != None {
|
||||||
let _ = unistd::unlink(tmp_path);
|
if let Err(err) = stat::fchmod(fd, mode) {
|
||||||
bail!("fchmod {:?} failed: {}", tmp_path, err);
|
let _ = unistd::unlink(tmp_path);
|
||||||
|
bail!("fchmod {:?} failed: {}", tmp_path, err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if owner != None || group != None {
|
if owner != None || group != None {
|
||||||
|
|
Loading…
Reference in New Issue