src/bin/proxmox-backup-client.rs: use std lib instead of nix
This commit is contained in:
parent
6e907505aa
commit
eb1804c567
|
@ -411,18 +411,23 @@ fn create_backup(
|
||||||
for backupspec in backupspec_list {
|
for backupspec in backupspec_list {
|
||||||
let (target, filename) = parse_backupspec(backupspec.as_str().unwrap())?;
|
let (target, filename) = parse_backupspec(backupspec.as_str().unwrap())?;
|
||||||
|
|
||||||
let stat = match nix::sys::stat::stat(filename) {
|
use std::os::unix::fs::FileTypeExt;
|
||||||
Ok(s) => s,
|
|
||||||
|
let metadata = match std::fs::metadata(filename) {
|
||||||
|
Ok(m) => m,
|
||||||
Err(err) => bail!("unable to access '{}' - {}", filename, err),
|
Err(err) => bail!("unable to access '{}' - {}", filename, err),
|
||||||
};
|
};
|
||||||
|
let file_type = metadata.file_type();
|
||||||
|
|
||||||
if (stat.st_mode & libc::S_IFMT) == libc::S_IFDIR {
|
if file_type.is_dir() {
|
||||||
|
|
||||||
upload_list.push((filename.to_owned(), target.to_owned()));
|
upload_list.push((filename.to_owned(), target.to_owned()));
|
||||||
|
|
||||||
} else if (stat.st_mode & (libc::S_IFREG|libc::S_IFBLK)) != 0 {
|
} else if file_type.is_file() || file_type.is_block_device() {
|
||||||
if stat.st_size <= 0 { bail!("got strange file size '{}'", stat.st_size); }
|
|
||||||
let _size = stat.st_size as usize;
|
let size = tools::image_size(&PathBuf::from(filename))?;
|
||||||
|
|
||||||
|
if size == 0 { bail!("got zero-sized file '{}'", filename); }
|
||||||
|
|
||||||
panic!("implement me");
|
panic!("implement me");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue