Set reasonable permissions for the root directory. Haiku seems to be a

bit pickier than BeOS.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20263 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2007-03-01 04:46:16 +00:00
parent 6d3667845f
commit 32164a180c
3 changed files with 8 additions and 5 deletions

View File

@ -159,7 +159,7 @@ Node::CheckPermissions(int mode) const
// root has always read/write permission, but at least one of the
// X bits must be set for execute permission
permissions = userPermissions | groupPermissions | otherPermissions
| S_IROTH | S_IWOTH;
| ACCESS_R | ACCESS_W;
// user is node owner
} else if (uid == fUID)
permissions = userPermissions;

View File

@ -57,8 +57,8 @@ public:
// stat data
// void SetMode(mode_t mode) { fMode = mode; }
inline void SetMode(mode_t mode) { fMode = fMode & S_IFMT | mode & ~S_IFMT; }
inline void SetMode(mode_t mode)
{ fMode = fMode & ~S_IUMSK | mode & S_IUMSK; }
inline mode_t GetMode() const { return fMode; }
inline void SetUID(uid_t uid) { fUID = uid; }

View File

@ -230,9 +230,12 @@ Volume::Mount(nspace_id id)
// create the root dir
if (error == B_OK) {
fRootDirectory = new(nothrow) Directory(this);
if (fRootDirectory)
if (fRootDirectory) {
// set permissions: -rwxr-xr-x
fRootDirectory->SetMode(
S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
error = fRootDirectory->Link(NULL);
else
} else
SET_ERROR(error, B_NO_MEMORY);
}
// set mounted flag / cleanup on error