Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions src/jailer/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,17 +574,20 @@
let host_cache_file = host_path.join(entry);
let jailer_cache_file = jailer_path.join(entry);

let line = readln_special(&host_cache_file)?;
writeln_special(&jailer_cache_file, line)?;

// We now change the permissions.
let dest_path_cstr = to_cstring(&jailer_cache_file)?;
// SAFETY: Safe because dest_path_cstr is null-terminated.
SyscallReturnCode(unsafe {
libc::chown(dest_path_cstr.as_ptr(), self.uid(), self.gid())
})
.into_empty_result()
.map_err(|err| JailerError::ChangeFileOwner(jailer_cache_file.to_owned(), err))?;
if let Ok(line) = readln_special(&host_cache_file) {
writeln_special(&jailer_cache_file, line)?;

// We now change the permissions.
let dest_path_cstr = to_cstring(&jailer_cache_file)?;
// SAFETY: Safe because dest_path_cstr is null-terminated.
SyscallReturnCode(unsafe {
libc::chown(dest_path_cstr.as_ptr(), self.uid(), self.gid())
})
.into_empty_result()
.map_err(|err| {
JailerError::ChangeFileOwner(jailer_cache_file.to_owned(), err)

Check warning on line 588 in src/jailer/src/env.rs

View check run for this annotation

Codecov / codecov/patch

src/jailer/src/env.rs#L588

Added line #L588 was not covered by tests
})?;
}

Check warning on line 590 in src/jailer/src/env.rs

View check run for this annotation

Codecov / codecov/patch

src/jailer/src/env.rs#L590

Added line #L590 was not covered by tests
}
}
Ok(())
Expand Down