mirror of
https://review.haiku-os.org/haiku
synced 2025-02-22 21:48:35 +01:00
* Prevent the /boot entry from ever being renamed. You couldn't even try to
switch /boot to a different volume in two operations, unless you have first linked /system/lib into /bin. This patch assumes that / will always have the ID 1. Don't know if that is proper. Note that I also thought about solving this in the VFS, since perhaps it isn't the job of root-fs to know about /boot, but that would of course introduce another check for every rename operation, which I decided against. +alphabranch git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32806 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
5ce0a8a2d2
commit
8c5ad61d4b
@ -930,9 +930,16 @@ rootfs_rename(fs_volume* _volume, fs_vnode* _fromDir, const char* fromName,
|
||||
struct rootfs_vnode* fromDirectory = (rootfs_vnode*)_fromDir->private_node;
|
||||
struct rootfs_vnode* toDirectory = (rootfs_vnode*)_toDir->private_node;
|
||||
|
||||
TRACE(("rootfs_rename: from %p (0x%Lx), fromName '%s', to %p (0x%Lx), "
|
||||
"toName '%s'\n", fromDirectory, fromDirectory->id, fromName, toDirectory,
|
||||
toDirectory->id, toName));
|
||||
TRACE(("rootfs_rename: from %p (0x%Lx, %s), fromName '%s', to %p "
|
||||
"(0x%Lx, %s), toName '%s'\n", fromDirectory, fromDirectory->id,
|
||||
fromDirectory->name != NULL ? fromDirectory->name : "NULL",
|
||||
fromName, toDirectory, toDirectory->id,
|
||||
toDirectory->name != NULL ? toDirectory->name : "NULL",
|
||||
toName));
|
||||
|
||||
// Prevent renaming /boot, since that will stop everything from working.
|
||||
if (fromDirectory->id == 1 && strcmp(fromName, "boot") == 0)
|
||||
return EPERM;
|
||||
|
||||
MutexLocker _(&fs->lock);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user