[pbs-devel] [PATCH proxmox] sys: file: use renameat2() from `nix` crate

Christoph Heiss c.heiss at proxmox.com
Fri Jul 12 09:44:05 CEST 2024


Thanks for the review!

On Fri, Jul 12, 2024 at 09:37:03AM GMT, Christian Ebner wrote:
> one small nit inline:
> > On 11.07.2024 19:07 CEST Christoph Heiss <c.heiss at proxmox.com> wrote:
> > [..]
> > +            // some file systems don't support `RENAME_NOREPLACE`
> >              // so we just use `link` + `unlink` instead
> > -            let result = Errno::result(libc::link(c_file_name.as_ptr(), new_path.as_ptr()));
> > -            let _ = libc::unlink(c_file_name.as_ptr());
> > +            let result = nix::unistd::linkat(
> > +                None,
> > +                &temp_file_name,
> > +                None,
> > +                &path.to_path_buf(),
> > +                nix::unistd::LinkatFlags::NoSymlinkFollow,
>
> According to
> https://docs.rs/nix/0.29.0/nix/unistd/type.LinkatFlags.html
> `LinkatFlags` will be deprecated with version 0.28. We currently use
> nix 0.16.1, which already provides the suggested replacment using the
> `AtFlags` https://docs.rs/nix/0.26.1/nix/fcntl/struct.AtFlags.html.
>
> So it would make sense to already use these instead.

Nice catch! I'll send a v2 :^)





More information about the pbs-devel mailing list