file_set_contents: correctly use perm parameter

This commit is contained in:
Dietmar Maurer 2018-12-09 16:41:54 +01:00
parent f12f8ff1a6
commit 1a7bc3dd5e
1 changed files with 2 additions and 2 deletions

View File

@ -23,10 +23,10 @@ pub fn file_set_contents<P: AsRef<Path>>(
let tmp_path = tmp_path.as_path(); let tmp_path = tmp_path.as_path();
let mode : stat::Mode = stat::Mode::from( let mode : stat::Mode = perm.unwrap_or(stat::Mode::from(
stat::Mode::S_IRUSR | stat::Mode::S_IWUSR | stat::Mode::S_IRUSR | stat::Mode::S_IWUSR |
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 let Err(err) = stat::fchmod(fd, mode) {
let _ = unistd::unlink(tmp_path); let _ = unistd::unlink(tmp_path);