vfs: support UNLINK_ERR_NO_ENTRY in TAR file system

We report UNLINK_ERR_NO_PERM only for files in TAR archive, otherwise
UNLINK_ERR_NO_ENTRY is returned. This permits the arbitrary layering of
file systems with support for proper ENOENT reporting, for example,
when using 'rm -f non_existent_file' that aborts if EPERM is wrongly
reported.
This commit is contained in:
Christian Helmuth 2016-04-29 16:01:55 +02:00
parent b8cd56cb90
commit b38c5006d8

View File

@ -508,7 +508,14 @@ class Vfs::Tar_file_system : public File_system
return DIRENT_OK;
}
Unlink_result unlink(char const *) override { return UNLINK_ERR_NO_PERM; }
Unlink_result unlink(char const *path) override
{
Node const *node = dereference(path);
if (!node)
return UNLINK_ERR_NO_ENTRY;
else
return UNLINK_ERR_NO_PERM;
}
Readlink_result readlink(char const *path, char *buf, file_size buf_size,
file_size &out_len) override