Skip to content

Commit

Permalink
fix: update dependency nix (#169)
Browse files Browse the repository at this point in the history
Due to a memory alignment bug, crashes on macOS happened. This is fixed
by this dependency update.

closes rustic-rs/rustic#1075
  • Loading branch information
aawsome authored Feb 24, 2024
1 parent d174395 commit 3907a5c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ cached = { version = "0.48.1", default-features = false, features = ["proc_macro
dunce = "1.0.4"
filetime = "0.2.23"
ignore = "0.4.22"
nix = { version = "0.27.1", default-features = false, features = ["user", "fs"] }
nix = { version = "0.28", default-features = false, features = ["user", "fs"] }
path-dedot = "3.1.1"
shell-words = "1.1.0"
walkdir = "2.4.0"
Expand Down
9 changes: 6 additions & 3 deletions crates/core/src/backend/local_destination.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ use log::warn;
#[cfg(not(windows))]
use nix::sys::stat::{mknod, Mode, SFlag};
#[cfg(not(windows))]
use nix::unistd::{fchownat, FchownatFlags, Gid, Group, Uid, User};
use nix::{
fcntl::AtFlags,
unistd::{fchownat, Gid, Group, Uid, User},
};

#[cfg(not(windows))]
use crate::backend::ignore::mapper::map_mode_from_go;
Expand Down Expand Up @@ -241,7 +244,7 @@ impl LocalDestination {
// use gid from group if valid, else from saved gid (if saved)
let gid = group.or_else(|| meta.gid.map(Gid::from_raw));

fchownat(None, &filename, uid, gid, FchownatFlags::NoFollowSymlink)
fchownat(None, &filename, uid, gid, AtFlags::AT_SYMLINK_NOFOLLOW)
.map_err(LocalDestinationErrorKind::FromErrnoError)?;
Ok(())
}
Expand Down Expand Up @@ -281,7 +284,7 @@ impl LocalDestination {
let uid = meta.uid.map(Uid::from_raw);
let gid = meta.gid.map(Gid::from_raw);

fchownat(None, &filename, uid, gid, FchownatFlags::NoFollowSymlink)
fchownat(None, &filename, uid, gid, AtFlags::AT_SYMLINK_NOFOLLOW)
.map_err(LocalDestinationErrorKind::FromErrnoError)?;
Ok(())
}
Expand Down

0 comments on commit 3907a5c

Please sign in to comment.