mirror of
https://github.com/vgough/encfs.git
synced 2024-11-21 23:43:26 +01:00
Cygwin, correct delete
When deleting a file, Windows first opens it, deletes it, and closes it. But Windows does not allow deleting opened files, so no need to check before deletion.
This commit is contained in:
parent
89215f16c5
commit
be0c616d38
@ -739,7 +739,9 @@ int DirNode::unlink(const char *plaintextName) {
|
||||
|
||||
Lock _lock(mutex);
|
||||
|
||||
int res = 0;
|
||||
// Windows does not allow deleting opened files, so no need to check
|
||||
// There is this "issue" however : https://github.com/billziss-gh/winfsp/issues/157
|
||||
#ifndef __CYGWIN__
|
||||
if ((ctx != nullptr) && ctx->lookupNode(plaintextName)) {
|
||||
// If FUSE is running with "hard_remove" option where it doesn't
|
||||
// hide open files for us, then we can't allow an unlink of an open
|
||||
@ -747,14 +749,16 @@ int DirNode::unlink(const char *plaintextName) {
|
||||
RLOG(WARNING) << "Refusing to unlink open file: " << cyName
|
||||
<< ", hard_remove option "
|
||||
"is probably in effect";
|
||||
res = -EBUSY;
|
||||
} else {
|
||||
string fullName = rootDir + cyName;
|
||||
res = ::unlink(fullName.c_str());
|
||||
if (res == -1) {
|
||||
res = -errno;
|
||||
VLOG(1) << "unlink error: " << strerror(-res);
|
||||
}
|
||||
return -EBUSY;
|
||||
}
|
||||
#endif
|
||||
|
||||
int res = 0;
|
||||
string fullName = rootDir + cyName;
|
||||
res = ::unlink(fullName.c_str());
|
||||
if (res == -1) {
|
||||
res = -errno;
|
||||
VLOG(1) << "unlink error: " << strerror(-res);
|
||||
}
|
||||
|
||||
return res;
|
||||
|
Loading…
Reference in New Issue
Block a user