[pbs-devel] [PATCH proxmox-backup 2/2] partially fix #2915: 'stat' in case ReadDirEntry does not contain type

Wolfgang Bumiller w.bumiller at proxmox.com
Tue Jun 28 13:52:50 CEST 2022


On Tue, Jun 28, 2022 at 01:49:23PM +0200, Wolfgang Bumiller wrote:
> On Tue, Jun 28, 2022 at 01:13:18PM +0200, Dominik Csapak wrote:
> > diff --git a/pbs-datastore/src/hierarchy.rs b/pbs-datastore/src/hierarchy.rs
> > index d5007b07..a97a1d2a 100644
> > --- a/pbs-datastore/src/hierarchy.rs
> > +++ b/pbs-datastore/src/hierarchy.rs
> > @@ -9,6 +9,16 @@ use pbs_api_types::{BackupNamespace, BackupType, BACKUP_DATE_REGEX, BACKUP_ID_RE
> >  use crate::backup_info::{BackupDir, BackupGroup};
> >  use crate::DataStore;
> >  
> > +fn dir_entry_is_path(entry: &proxmox_sys::fs::ReadDirEntry) -> Result<bool, Error> {
> > +    let stat = nix::sys::stat::fstatat(
> > +        entry.parent_fd(),
> > +        entry.file_name(),
> > +        nix::fcntl::AtFlags::AT_SYMLINK_NOFOLLOW,
> > +    )?;
> > +    let is_dir = stat.st_mode & libc::S_IFDIR > 0;
> 
> Should be `(stat.st_mode & libc::S_IFMT) != libc::S_IFDIR`.

I meant `==` here ;-)





More information about the pbs-devel mailing list