libc, vfs: rename improvements

Perform POSIX rename checks at the libc VFS plugin.
Clarify rename at VFS fs, ram, single, and tar file systems.

Issue #1900
Fixes #1782
This commit is contained in:
Emery Hemingway
2016-03-02 14:32:43 +01:00
committed by Christian Helmuth
parent d0735b1734
commit 23c1d4c66d
6 changed files with 61 additions and 24 deletions

View File

@ -124,7 +124,7 @@ class Vfs::Single_file_system : public File_system
char const *leaf_path(char const *path) override
{
return path;
return _is_single_file(path) ? path : 0;
}
Open_result open(char const *path, unsigned,
@ -148,9 +148,11 @@ class Vfs::Single_file_system : public File_system
return READLINK_ERR_NO_ENTRY;
}
Rename_result rename(char const *, char const *) override
Rename_result rename(char const *from, char const *to) override
{
return RENAME_ERR_NO_PERM;
if (_is_single_file(from) || _is_single_file(to))
return RENAME_ERR_NO_PERM;
return RENAME_ERR_NO_ENTRY;
}
Mkdir_result mkdir(char const *, unsigned) override