mirror of
https://github.com/digarok/gsplus.git
synced 2024-11-24 06:34:02 +00:00
host fst - return a better error for ChangePathGS when destination file exists and DestroyGS when file is non-empty directory
This commit is contained in:
parent
67a8d7a0c6
commit
30491a39a0
@ -256,6 +256,9 @@ word32 host_map_errno(int xerrno) {
|
|||||||
return outOfMem;
|
return outOfMem;
|
||||||
case EEXIST:
|
case EEXIST:
|
||||||
return dupPathname;
|
return dupPathname;
|
||||||
|
case ENOTEMPTY:
|
||||||
|
return invalidAccess;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return drvrIOError;
|
return drvrIOError;
|
||||||
}
|
}
|
||||||
|
@ -1527,7 +1527,9 @@ static word32 fst_change_path(int class, const char *path1, const char *path2) {
|
|||||||
if (host_is_root(&st))
|
if (host_is_root(&st))
|
||||||
return invalidAccess;
|
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);
|
if (rename(path1, path2) < 0) return host_map_errno_path(errno, path2);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user