summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-02-06 01:32:37 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2024-02-06 01:34:50 -0500
commit168126a41e1d2d43104988d113603fcc13d020e0 (patch)
tree6c24b17206f3dbfcab6890671286582ddcb5b7eb /src
parentf3f005c76eb5636542a8f5b137bd1904d57e8f86 (diff)
fix snapshotting when dst is single component path
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'src')
-rw-r--r--src/commands/cmd_subvolume.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/commands/cmd_subvolume.rs b/src/commands/cmd_subvolume.rs
index 85183fa4..a3176f40 100644
--- a/src/commands/cmd_subvolume.rs
+++ b/src/commands/cmd_subvolume.rs
@@ -53,7 +53,9 @@ pub fn cmd_subvolumes(argv: Vec<String>) -> i32 {
},
Subcommands::Snapshot { read_only, source, dest } => {
if let Some(dirname) = dest.parent() {
- let fs = unsafe { BcachefsHandle::open(dirname) };
+ let dot = PathBuf::from(".");
+ let dir = if dirname.as_os_str().is_empty() { &dot } else { dirname };
+ let fs = unsafe { BcachefsHandle::open(dir) };
fs.snapshot_subvolume(if read_only { BCH_SUBVOL_SNAPSHOT_RO } else { 0x0 }, source, dest).expect("Failed to snapshot the subvolume");
}