Don't crash when trying to chmod/chown the root directory
This commit is contained in:
parent
6821684654
commit
89a9f1e3d2
@ -73,19 +73,29 @@ unique_ptr<Blob> CryNode::LoadBlob() const {
|
||||
|
||||
void CryNode::stat(struct ::stat *result) const {
|
||||
if(_parent.get() == nullptr) {
|
||||
//We arethe root directory.
|
||||
//TODO What should we do?
|
||||
result->st_mode = S_IFDIR;
|
||||
//We are the root directory.
|
||||
//TODO What should we do?
|
||||
result->st_mode = S_IFDIR;
|
||||
} else {
|
||||
_parent->statChild(_key, result);
|
||||
}
|
||||
}
|
||||
|
||||
void CryNode::chmod(mode_t mode) {
|
||||
if (_parent.get() == nullptr) {
|
||||
//We are the root direcory.
|
||||
//TODO What should we do?
|
||||
throw FuseErrnoException(EIO);
|
||||
}
|
||||
_parent->chmodChild(_key, mode);
|
||||
}
|
||||
|
||||
void CryNode::chown(uid_t uid, gid_t gid) {
|
||||
if (_parent.get() == nullptr) {
|
||||
//We are the root direcory.
|
||||
//TODO What should we do?
|
||||
throw FuseErrnoException(EIO);
|
||||
}
|
||||
_parent->chownChild(_key, uid, gid);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user