From 20e2043a08bc16951ddd63230430c5f000923255 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Fri, 11 Jan 2019 13:12:55 +0100 Subject: [PATCH] catar/decoder.rs: corrently pass mode to mknodat --- src/catar/decoder.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/catar/decoder.rs b/src/catar/decoder.rs index 33585988..5ad337c8 100644 --- a/src/catar/decoder.rs +++ b/src/catar/decoder.rs @@ -234,8 +234,9 @@ impl <'a, R: Read + Seek> CaTarDecoder<'a, R> { fn restore_device_at(&mut self, entry: &CaFormatEntry, dirfd: RawFd, filename: &OsStr, device: &CaFormatDevice) -> Result<(), Error> { let rdev = nix::sys::stat::makedev(device.major, device.minor); + let mode = ((entry.mode as u32) & libc::S_IFMT) | 0o0600; let res = filename.with_nix_path(|cstr| unsafe { - libc::mknodat(dirfd, cstr.as_ptr(), 0o0600, rdev) + libc::mknodat(dirfd, cstr.as_ptr(), mode, rdev) })?; Errno::result(res)?;