Prevent creation of entries in unlinked directories.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37563 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
7b8dcda464
commit
a628d23613
@ -546,6 +546,10 @@ checksumfs_create_symlink(fs_volume* fsVolume, fs_vnode* parent,
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
// don't create an entry in an unlinked directory
|
||||
if (directory->HardLinks() == 0)
|
||||
RETURN_ERROR(B_ENTRY_NOT_FOUND);
|
||||
|
||||
// create a symlink node
|
||||
SymLink* newSymLink;
|
||||
error = volume->CreateSymLink(mode, transaction, newSymLink);
|
||||
@ -849,13 +853,16 @@ checksumfs_create(fs_volume* fsVolume, fs_vnode* parent, const char* name,
|
||||
RETURN_ERROR(error);
|
||||
|
||||
// The entry doesn't exist yet. We have to create a new file.
|
||||
// TODO: Don't do that in an unlinked directory!
|
||||
|
||||
// check the directory write permission
|
||||
error = check_access(directory, W_OK);
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
// don't create an entry in an unlinked directory
|
||||
if (directory->HardLinks() == 0)
|
||||
RETURN_ERROR(B_ENTRY_NOT_FOUND);
|
||||
|
||||
// start a transaction and attach the directory
|
||||
Transaction transaction(volume);
|
||||
error = transaction.StartAndAddNode(directory,
|
||||
@ -1121,6 +1128,10 @@ checksumfs_create_dir(fs_volume* fsVolume, fs_vnode* parent, const char* name,
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
// don't create an entry in an unlinked directory
|
||||
if (directory->HardLinks() == 0)
|
||||
RETURN_ERROR(B_ENTRY_NOT_FOUND);
|
||||
|
||||
// create a directory node
|
||||
Directory* newDirectory;
|
||||
error = volume->CreateDirectory(perms, transaction, newDirectory);
|
||||
|
Loading…
Reference in New Issue
Block a user