diff --git a/src/tests/system/kernel/file_corruption/fs/checksumfs.cpp b/src/tests/system/kernel/file_corruption/fs/checksumfs.cpp index 339625985c..353374d1fa 100644 --- a/src/tests/system/kernel/file_corruption/fs/checksumfs.cpp +++ b/src/tests/system/kernel/file_corruption/fs/checksumfs.cpp @@ -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);