Skip to content

Commit

Permalink
Fix read-only detection for volumes mounted as read-only
Browse files Browse the repository at this point in the history
* Fixes #114.
  • Loading branch information
KapiX committed May 11, 2019
1 parent b2525b5 commit 1e29280
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/support/File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <EntryOperationEngineBase.h>
#include <NodeInfo.h>
#include <NodeMonitor.h>
#include <Volume.h>
#include <kernel/fs_attr.h>

#include <vector>
Expand Down Expand Up @@ -156,6 +157,14 @@ File::CanWrite(BStatable* file)
if(file == nullptr)
return false;

BVolume volume;
if(file->GetVolume(&volume) < B_OK) {
return false;
}
if(volume.IsReadOnly()) {
return false;
}

mode_t permissions;
if(file->GetPermissions(&permissions) < B_OK) {
return false;
Expand Down

0 comments on commit 1e29280

Please sign in to comment.