Adopted LFS3_ERR_BUSY for root-related errors

Now that we use LFS3_ERR_BUSY for traversals, we no longer have an
excuse for not returning LFS3_ERR_BUSY on root-related errors:

- lfs3_remove(&lfs3, "/") => LFS3_ERR_BUSY
- lfs3_rename(&lfs3, "/", *) => LFS3_ERR_BUSY
- lfs3_rename(&lfs3, *, "/") => LFS3_ERR_BUSY

This better aligns with POSIX. Arguably we should have defined
LFS3_ERR_BUSY for this case anyways, it's not like additional error
codes cost much.

No code changes.
This commit is contained in:
Christopher Haster
2025-11-09 01:02:18 -06:00
parent 4010afeafd
commit e196be53df
5 changed files with 47 additions and 47 deletions
+3 -3
View File
@@ -11635,7 +11635,7 @@ int lfs3_remove(lfs3_t *lfs3, const char *path) {
// trying to remove the root dir?
if (mdir.mid == -1) {
return LFS3_ERR_INVAL;
return LFS3_ERR_BUSY;
}
// if we're removing a directory, we need to also remove the
@@ -11756,7 +11756,7 @@ int lfs3_rename(lfs3_t *lfs3, const char *old_path, const char *new_path) {
// trying to rename the root?
if (old_mdir.mid == -1) {
return LFS3_ERR_INVAL;
return LFS3_ERR_BUSY;
}
// lookup new entry
@@ -11786,7 +11786,7 @@ int lfs3_rename(lfs3_t *lfs3, const char *old_path, const char *new_path) {
} else {
// trying to rename the root?
if (new_mdir.mid == -1) {
return LFS3_ERR_INVAL;
return LFS3_ERR_BUSY;
}
// we allow reg <-> stickynote renaming, but renaming a non-dir