summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkoverstreet <kent.overstreet@gmail.com>2024-06-09 17:43:41 -0400
committerGitHub <noreply@github.com>2024-06-09 17:43:41 -0400
commitc2354f0326f5ad7fa5fd4d759f923f43daf9890a (patch)
tree1663e9163406a75904cb96df5c3f8ff320659aa6
parente1fa076a86047f6c5d305c0756adbf3b2810c070 (diff)
parentb42b5b4065542d513f7114cccc6cdc9d51d0f055 (diff)
Merge pull request #293 from tmuehlbacher/fix-subvolume-commands-with-relative-paths
fix(subvol): make cmds work with relative paths
-rw-r--r--src/commands/subvolume.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/commands/subvolume.rs b/src/commands/subvolume.rs
index a5ebcf53..64743115 100644
--- a/src/commands/subvolume.rs
+++ b/src/commands/subvolume.rs
@@ -42,6 +42,10 @@ pub fn subvolume(argv: Vec<String>) -> i32 {
match cli.subcommands {
Subcommands::Create { targets } => {
for target in targets {
+ let target = target
+ .canonicalize()
+ .expect("unable to canonicalize a target path");
+
if let Some(dirname) = target.parent() {
let fs = unsafe { BcachefsHandle::open(dirname) };
fs.create_subvolume(target)
@@ -50,6 +54,10 @@ pub fn subvolume(argv: Vec<String>) -> i32 {
}
}
Subcommands::Delete { target } => {
+ let target = target
+ .canonicalize()
+ .expect("unable to canonicalize a target path");
+
if let Some(dirname) = target.parent() {
let fs = unsafe { BcachefsHandle::open(dirname) };
fs.delete_subvolume(target)