commit 3a50491b8544eaf03cba05f691f37f8ab98fd449
parent 161d1c016c94e4701ac0bfdd4699210ef1f2180e
Author: Drew DeVault <sir@cmpwn.com>
Date: Sat, 8 Jan 2022 15:43:27 +0100
fs::rmdirall: use path::buffer
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Diffstat:
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/fs/fs.ha b/fs/fs.ha
@@ -229,14 +229,15 @@ export fn rmdirall(fs: *fs, path: str) (void | error) = {
if (ent.name == "." || ent.name == "..") {
continue;
};
- let p = path::join(path, ent.name);
- defer free(p);
+ let buf = alloc(path::init());
+ defer free(buf);
+ const path = path::set(buf, path, ent.name)!;
switch (ent.ftype & mode::DIR) {
case mode::DIR =>
- rmdirall(fs, p)?;
+ rmdirall(fs, path)?;
case =>
- remove(fs, p)?;
+ remove(fs, path)?;
};
case void =>
break;