diff --git a/src/host_common.c b/src/host_common.c index ddb12d4..158db53 100644 --- a/src/host_common.c +++ b/src/host_common.c @@ -256,6 +256,9 @@ word32 host_map_errno(int xerrno) { return outOfMem; case EEXIST: return dupPathname; + case ENOTEMPTY: + return invalidAccess; + default: return drvrIOError; } diff --git a/src/host_fst.c b/src/host_fst.c index 940d63f..c1cfbd1 100644 --- a/src/host_fst.c +++ b/src/host_fst.c @@ -1527,7 +1527,9 @@ static word32 fst_change_path(int class, const char *path1, const char *path2) { if (host_is_root(&st)) return invalidAccess; - // rename will delete any previous file. + // rename will delete any previous file. ChangePath should return an error. + if (stat(path2, &st) == 0) return dupPathname; + if (rename(path1, path2) < 0) return host_map_errno_path(errno, path2); return 0; }