summaryrefslogtreecommitdiffstats
path: root/src/mtab.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2022-12-30 14:49:46 -0500
committerTavian Barnes <tavianator@tavianator.com>2023-01-19 14:41:55 -0500
commit683552c4c9a3dfee4ce603157bb2cf18d64fbcfc (patch)
tree475130eeb136007eea7c59cb7190dc05287e2c56 /src/mtab.c
parent944cd72f40a84d318453c320a84d443273956859 (diff)
downloadbfs-683552c4c9a3dfee4ce603157bb2cf18d64fbcfc.tar.xz
bfstd: New wrappers for dirname()/basename()
Diffstat (limited to 'src/mtab.c')
-rw-r--r--src/mtab.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mtab.c b/src/mtab.c
index 316ec6e..39676e5 100644
--- a/src/mtab.c
+++ b/src/mtab.c
@@ -86,7 +86,8 @@ static int bfs_mtab_add(struct bfs_mtab *mtab, const char *path, const char *typ
goto fail_entry;
}
- if (!trie_insert_str(&mtab->names, xbasename(path))) {
+ const char *name = path + xbaseoff(path);
+ if (!trie_insert_str(&mtab->names, name)) {
goto fail;
}
@@ -223,7 +224,7 @@ const char *bfs_fstype(const struct bfs_mtab *mtab, const struct bfs_stat *statb
}
bool bfs_might_be_mount(const struct bfs_mtab *mtab, const char *path) {
- const char *name = xbasename(path);
+ const char *name = path + xbaseoff(path);
return trie_find_str(&mtab->names, name);
}