mirror of
https://github.com/vgough/encfs.git
synced 2024-11-21 23:43:26 +01:00
modernize: unindent else after return
This commit is contained in:
parent
c37ab8e671
commit
f9d22c4f18
@ -73,25 +73,24 @@ ssize_t BlockFileIO::cacheReadOneBlock(const IORequest &req) const {
|
||||
if (_cache.dataLen < len) len = _cache.dataLen; // Don't read past EOF
|
||||
memcpy(req.data, _cache.data, len);
|
||||
return len;
|
||||
} else {
|
||||
if (_cache.dataLen > 0) clearCache(_cache, _blockSize);
|
||||
|
||||
// cache results of read -- issue reads for full blocks
|
||||
IORequest tmp;
|
||||
tmp.offset = req.offset;
|
||||
tmp.data = _cache.data;
|
||||
tmp.dataLen = _blockSize;
|
||||
ssize_t result = readOneBlock(tmp);
|
||||
if (result > 0) {
|
||||
_cache.offset = req.offset;
|
||||
_cache.dataLen = result; // the amount we really have
|
||||
if (result > req.dataLen) {
|
||||
result = req.dataLen; // only as much as requested
|
||||
}
|
||||
memcpy(req.data, _cache.data, result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
if (_cache.dataLen > 0) clearCache(_cache, _blockSize);
|
||||
|
||||
// cache results of read -- issue reads for full blocks
|
||||
IORequest tmp;
|
||||
tmp.offset = req.offset;
|
||||
tmp.data = _cache.data;
|
||||
tmp.dataLen = _blockSize;
|
||||
ssize_t result = readOneBlock(tmp);
|
||||
if (result > 0) {
|
||||
_cache.offset = req.offset;
|
||||
_cache.dataLen = result; // the amount we really have
|
||||
if (result > req.dataLen) {
|
||||
result = req.dataLen; // only as much as requested
|
||||
}
|
||||
memcpy(req.data, _cache.data, result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool BlockFileIO::cacheWriteOneBlock(const IORequest &req) {
|
||||
@ -123,52 +122,51 @@ ssize_t BlockFileIO::read(const IORequest &req) const {
|
||||
// read completely within a single block -- can be handled as-is by
|
||||
// readOneBlock().
|
||||
return cacheReadOneBlock(req);
|
||||
} else {
|
||||
size_t size = req.dataLen;
|
||||
}
|
||||
size_t size = req.dataLen;
|
||||
|
||||
// if the request is larger then a block, then request each block
|
||||
// individually
|
||||
MemBlock mb; // in case we need to allocate a temporary block..
|
||||
IORequest blockReq; // for requests we may need to make
|
||||
blockReq.dataLen = _blockSize;
|
||||
blockReq.data = nullptr;
|
||||
// if the request is larger then a block, then request each block
|
||||
// individually
|
||||
MemBlock mb; // in case we need to allocate a temporary block..
|
||||
IORequest blockReq; // for requests we may need to make
|
||||
blockReq.dataLen = _blockSize;
|
||||
blockReq.data = nullptr;
|
||||
|
||||
unsigned char *out = req.data;
|
||||
while (size != 0u) {
|
||||
blockReq.offset = blockNum * _blockSize;
|
||||
unsigned char *out = req.data;
|
||||
while (size != 0u) {
|
||||
blockReq.offset = blockNum * _blockSize;
|
||||
|
||||
// if we're reading a full block, then read directly into the
|
||||
// result buffer instead of using a temporary
|
||||
if (partialOffset == 0 && size >= (size_t)_blockSize) {
|
||||
blockReq.data = out;
|
||||
} else {
|
||||
if (mb.data == nullptr) mb = MemoryPool::allocate(_blockSize);
|
||||
blockReq.data = mb.data;
|
||||
}
|
||||
|
||||
ssize_t readSize = cacheReadOneBlock(blockReq);
|
||||
if (readSize <= partialOffset) break; // didn't get enough bytes
|
||||
|
||||
int cpySize = min((size_t)(readSize - partialOffset), size);
|
||||
CHECK(cpySize <= readSize);
|
||||
|
||||
// if we read to a temporary buffer, then move the data
|
||||
if (blockReq.data != out) {
|
||||
memcpy(out, blockReq.data + partialOffset, cpySize);
|
||||
}
|
||||
|
||||
result += cpySize;
|
||||
size -= cpySize;
|
||||
out += cpySize;
|
||||
++blockNum;
|
||||
partialOffset = 0;
|
||||
|
||||
if (readSize < _blockSize) break;
|
||||
// if we're reading a full block, then read directly into the
|
||||
// result buffer instead of using a temporary
|
||||
if (partialOffset == 0 && size >= (size_t)_blockSize) {
|
||||
blockReq.data = out;
|
||||
} else {
|
||||
if (mb.data == nullptr) mb = MemoryPool::allocate(_blockSize);
|
||||
blockReq.data = mb.data;
|
||||
}
|
||||
|
||||
if (mb.data != nullptr) MemoryPool::release(mb);
|
||||
ssize_t readSize = cacheReadOneBlock(blockReq);
|
||||
if (readSize <= partialOffset) break; // didn't get enough bytes
|
||||
|
||||
int cpySize = min((size_t)(readSize - partialOffset), size);
|
||||
CHECK(cpySize <= readSize);
|
||||
|
||||
// if we read to a temporary buffer, then move the data
|
||||
if (blockReq.data != out) {
|
||||
memcpy(out, blockReq.data + partialOffset, cpySize);
|
||||
}
|
||||
|
||||
result += cpySize;
|
||||
size -= cpySize;
|
||||
out += cpySize;
|
||||
++blockNum;
|
||||
partialOffset = 0;
|
||||
|
||||
if (readSize < _blockSize) break;
|
||||
}
|
||||
|
||||
if (mb.data != nullptr) MemoryPool::release(mb);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -91,9 +91,8 @@ Interface BlockNameIO::CurrentInterface(bool caseInsensitive) {
|
||||
// implement major version 4 plus support for two prior versions
|
||||
if (caseInsensitive) {
|
||||
return Interface("nameio/block32", 4, 0, 2);
|
||||
} else {
|
||||
return Interface("nameio/block", 4, 0, 2);
|
||||
}
|
||||
return Interface("nameio/block", 4, 0, 2);
|
||||
}
|
||||
|
||||
BlockNameIO::BlockNameIO(const Interface &iface, std::shared_ptr<Cipher> cipher,
|
||||
@ -121,9 +120,8 @@ int BlockNameIO::maxEncodedNameLen(int plaintextNameLen) const {
|
||||
int encodedNameLen = numBlocks * _bs + 2; // 2 checksum bytes
|
||||
if (_caseInsensitive) {
|
||||
return B256ToB32Bytes(encodedNameLen);
|
||||
} else {
|
||||
return B256ToB64Bytes(encodedNameLen);
|
||||
}
|
||||
return B256ToB64Bytes(encodedNameLen);
|
||||
}
|
||||
|
||||
int BlockNameIO::maxDecodedNameLen(int encodedNameLen) const {
|
||||
|
@ -105,10 +105,9 @@ bool CipherFileIO::setIV(uint64_t iv) {
|
||||
// duh -- there are no file headers for directories!
|
||||
externalIV = iv;
|
||||
return base->setIV(iv);
|
||||
} else {
|
||||
VLOG(1) << "writeHeader failed to re-open for write";
|
||||
return false;
|
||||
}
|
||||
VLOG(1) << "writeHeader failed to re-open for write";
|
||||
return false;
|
||||
}
|
||||
initHeader();
|
||||
}
|
||||
@ -391,9 +390,8 @@ bool CipherFileIO::blockWrite(unsigned char *buf, int size,
|
||||
VLOG(1) << "Called blockWrite";
|
||||
if (!fsConfig->reverseEncryption) {
|
||||
return cipher->blockEncode(buf, size, _iv64, key);
|
||||
} else {
|
||||
return cipher->blockDecode(buf, size, _iv64, key);
|
||||
}
|
||||
return cipher->blockDecode(buf, size, _iv64, key);
|
||||
}
|
||||
|
||||
bool CipherFileIO::streamWrite(unsigned char *buf, int size,
|
||||
@ -401,36 +399,32 @@ bool CipherFileIO::streamWrite(unsigned char *buf, int size,
|
||||
VLOG(1) << "Called streamWrite";
|
||||
if (!fsConfig->reverseEncryption) {
|
||||
return cipher->streamEncode(buf, size, _iv64, key);
|
||||
} else {
|
||||
return cipher->streamDecode(buf, size, _iv64, key);
|
||||
}
|
||||
return cipher->streamDecode(buf, size, _iv64, key);
|
||||
}
|
||||
|
||||
bool CipherFileIO::blockRead(unsigned char *buf, int size,
|
||||
uint64_t _iv64) const {
|
||||
if (fsConfig->reverseEncryption) {
|
||||
return cipher->blockEncode(buf, size, _iv64, key);
|
||||
} else {
|
||||
if (_allowHoles) {
|
||||
// special case - leave all 0's alone
|
||||
for (int i = 0; i < size; ++i) {
|
||||
if (buf[i] != 0) return cipher->blockDecode(buf, size, _iv64, key);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return cipher->blockDecode(buf, size, _iv64, key);
|
||||
}
|
||||
}
|
||||
if (_allowHoles) {
|
||||
// special case - leave all 0's alone
|
||||
for (int i = 0; i < size; ++i) {
|
||||
if (buf[i] != 0) return cipher->blockDecode(buf, size, _iv64, key);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return cipher->blockDecode(buf, size, _iv64, key);
|
||||
}
|
||||
|
||||
bool CipherFileIO::streamRead(unsigned char *buf, int size,
|
||||
uint64_t _iv64) const {
|
||||
if (fsConfig->reverseEncryption) {
|
||||
return cipher->streamEncode(buf, size, _iv64, key);
|
||||
} else {
|
||||
return cipher->streamDecode(buf, size, _iv64, key);
|
||||
}
|
||||
return cipher->streamDecode(buf, size, _iv64, key);
|
||||
}
|
||||
|
||||
int CipherFileIO::truncate(off_t size) {
|
||||
@ -519,11 +513,10 @@ ssize_t CipherFileIO::read(const IORequest &origReq) const {
|
||||
VLOG(1) << "read " << readBytes << " bytes from backing file";
|
||||
if (readBytes < 0) {
|
||||
return readBytes; // Return error code
|
||||
} else {
|
||||
ssize_t sum = headerBytes + readBytes;
|
||||
VLOG(1) << "returning sum=" << sum;
|
||||
return sum;
|
||||
}
|
||||
ssize_t sum = headerBytes + readBytes;
|
||||
VLOG(1) << "returning sum=" << sum;
|
||||
return sum;
|
||||
}
|
||||
|
||||
bool CipherFileIO::isWritable() const { return base->isWritable(); }
|
||||
|
@ -129,9 +129,8 @@ ConfigVar ConfigReader::operator[](const std::string &varName) const {
|
||||
auto it = vars.find(varName);
|
||||
if (it == vars.end()) {
|
||||
return ConfigVar();
|
||||
} else {
|
||||
return it->second;
|
||||
}
|
||||
return it->second;
|
||||
}
|
||||
|
||||
ConfigVar &ConfigReader::operator[](const std::string &varName) {
|
||||
|
@ -45,9 +45,8 @@ ConfigVar::~ConfigVar() { pd.reset(); }
|
||||
ConfigVar &ConfigVar::operator=(const ConfigVar &src) {
|
||||
if (src.pd == pd) {
|
||||
return *this;
|
||||
} else {
|
||||
pd = src.pd;
|
||||
}
|
||||
pd = src.pd;
|
||||
|
||||
return *this;
|
||||
}
|
||||
@ -142,9 +141,8 @@ int ConfigVar::readInt(int defaultValue) const {
|
||||
|
||||
if (offset >= bytes) {
|
||||
return defaultValue;
|
||||
} else {
|
||||
return readInt();
|
||||
}
|
||||
return readInt();
|
||||
}
|
||||
|
||||
bool ConfigVar::readBool(bool defaultValue) const {
|
||||
|
@ -81,10 +81,9 @@ static bool _nextName(struct dirent *&de, const std::shared_ptr<DIR> &dir,
|
||||
}
|
||||
if (inode != nullptr) *inode = de->d_ino;
|
||||
return true;
|
||||
} else {
|
||||
if (fileType != nullptr) *fileType = 0;
|
||||
return false;
|
||||
}
|
||||
if (fileType != nullptr) *fileType = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string DirTraverse::nextPlaintextName(int *fileType, ino_t *inode) {
|
||||
@ -350,19 +349,18 @@ DirTraverse DirNode::openDir(const char *plaintextPath) {
|
||||
if (dir == nullptr) {
|
||||
VLOG(1) << "opendir error " << strerror(errno);
|
||||
return DirTraverse(shared_ptr<DIR>(), 0, std::shared_ptr<NameIO>());
|
||||
} else {
|
||||
std::shared_ptr<DIR> dp(dir, DirDeleter());
|
||||
|
||||
uint64_t iv = 0;
|
||||
// if we're using chained IV mode, then compute the IV at this
|
||||
// directory level..
|
||||
try {
|
||||
if (naming->getChainedNameIV()) naming->encodePath(plaintextPath, &iv);
|
||||
} catch (encfs::Error &err) {
|
||||
RLOG(ERROR) << "encode err: " << err.what();
|
||||
}
|
||||
return DirTraverse(dp, iv, naming);
|
||||
}
|
||||
std::shared_ptr<DIR> dp(dir, DirDeleter());
|
||||
|
||||
uint64_t iv = 0;
|
||||
// if we're using chained IV mode, then compute the IV at this
|
||||
// directory level..
|
||||
try {
|
||||
if (naming->getChainedNameIV()) naming->encodePath(plaintextPath, &iv);
|
||||
} catch (encfs::Error &err) {
|
||||
RLOG(ERROR) << "encode err: " << err.what();
|
||||
}
|
||||
return DirTraverse(dp, iv, naming);
|
||||
}
|
||||
|
||||
bool DirNode::genRenameList(list<RenameEl> &renameList, const char *fromP,
|
||||
@ -477,9 +475,8 @@ std::shared_ptr<RenameOp> DirNode::newRenameOp(const char *fromP,
|
||||
if (!genRenameList(*renameList.get(), fromP, toP)) {
|
||||
RLOG(WARNING) << "Error during generation of recursive rename list";
|
||||
return std::shared_ptr<RenameOp>();
|
||||
} else {
|
||||
return std::make_shared<RenameOp>(this, renameList);
|
||||
}
|
||||
return std::make_shared<RenameOp>(this, renameList);
|
||||
}
|
||||
|
||||
int DirNode::mkdir(const char *plaintextPath, mode_t mode, uid_t uid,
|
||||
@ -679,9 +676,8 @@ std::shared_ptr<FileNode> DirNode::openNode(const char *plainName,
|
||||
|
||||
if (node && (*result = node->open(flags)) >= 0) {
|
||||
return node;
|
||||
} else {
|
||||
return std::shared_ptr<FileNode>();
|
||||
}
|
||||
return std::shared_ptr<FileNode>();
|
||||
}
|
||||
|
||||
int DirNode::unlink(const char *plaintextName) {
|
||||
|
@ -102,9 +102,8 @@ static bool setIV(const std::shared_ptr<FileIO> &io, uint64_t iv) {
|
||||
struct stat stbuf;
|
||||
if ((io->getAttr(&stbuf) < 0) || S_ISREG(stbuf.st_mode)) {
|
||||
return io->setIV(iv);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FileNode::setName(const char *plaintextName_, const char *cipherName_,
|
||||
@ -261,9 +260,8 @@ int FileNode::sync(bool datasync) {
|
||||
if (res == -1) res = -errno;
|
||||
|
||||
return res;
|
||||
} else {
|
||||
return fh;
|
||||
}
|
||||
return fh;
|
||||
}
|
||||
|
||||
} // namespace encfs
|
||||
|
@ -127,27 +127,24 @@ bool fileExists(const char *fileName) {
|
||||
struct stat buf;
|
||||
if (lstat(fileName, &buf) == 0) {
|
||||
return true;
|
||||
} else {
|
||||
// XXX show perror?
|
||||
return false;
|
||||
}
|
||||
// XXX show perror?
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isDirectory(const char *fileName) {
|
||||
struct stat buf;
|
||||
if (lstat(fileName, &buf) == 0) {
|
||||
return S_ISDIR(buf.st_mode);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isAbsolutePath(const char *fileName) {
|
||||
if ((fileName != nullptr) && fileName[0] != '\0' && fileName[0] == '/') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const char *lastPathElement(const char *name) {
|
||||
@ -159,9 +156,8 @@ std::string parentDirectory(const std::string &path) {
|
||||
size_t last = path.find_last_of('/');
|
||||
if (last == string::npos) {
|
||||
return string("");
|
||||
} else {
|
||||
return path.substr(0, last);
|
||||
}
|
||||
return path.substr(0, last);
|
||||
}
|
||||
|
||||
bool userAllowMkdir(const char *path, mode_t mode) {
|
||||
@ -196,14 +192,12 @@ bool userAllowMkdir(int promptno, const char *path, mode_t mode) {
|
||||
if (result < 0) {
|
||||
perror(_("Unable to create directory: "));
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
// Directory not created, by user request
|
||||
cerr << _("Directory not created.") << "\n";
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
// Directory not created, by user request
|
||||
cerr << _("Directory not created.") << "\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -842,10 +836,12 @@ static bool boolDefault(const char *prompt, bool defaultValue) {
|
||||
if (cin.fail() || response == "") {
|
||||
value = defaultValue;
|
||||
break;
|
||||
} else if (response == "y") {
|
||||
}
|
||||
if (response == "y") {
|
||||
value = true;
|
||||
break;
|
||||
} else if (response == "n") {
|
||||
}
|
||||
if (response == "n") {
|
||||
value = false;
|
||||
break;
|
||||
}
|
||||
@ -1119,10 +1115,9 @@ RootPtr createV6Config(EncFS_Context *ctx,
|
||||
_("Unable to instanciate cipher %s, key size %i, block size %i"),
|
||||
alg.name.c_str(), keySize, blockSize);
|
||||
return rootInfo;
|
||||
} else {
|
||||
VLOG(1) << "Using cipher " << alg.name << ", key size " << keySize
|
||||
<< ", block size " << blockSize;
|
||||
}
|
||||
VLOG(1) << "Using cipher " << alg.name << ", key size " << keySize
|
||||
<< ", block size " << blockSize;
|
||||
|
||||
std::shared_ptr<EncFSConfig> config(new EncFSConfig);
|
||||
|
||||
@ -1672,10 +1667,9 @@ int remountFS(EncFS_Context *ctx) {
|
||||
if (rootInfo) {
|
||||
ctx->setRoot(rootInfo->root);
|
||||
return 0;
|
||||
} else {
|
||||
RLOG(WARNING) << "Remount failed";
|
||||
return -EACCES;
|
||||
}
|
||||
RLOG(WARNING) << "Remount failed";
|
||||
return -EACCES;
|
||||
}
|
||||
|
||||
} // namespace encfs
|
||||
|
@ -85,11 +85,11 @@ static int sign( int a, int b )
|
||||
static int sign(int a, int b) {
|
||||
if (a < b) {
|
||||
return 0;
|
||||
} else if (a == b) {
|
||||
return 1;
|
||||
} else {
|
||||
return 2;
|
||||
}
|
||||
if (a == b) {
|
||||
return 1;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -117,33 +117,29 @@ bool Interface::implements(const Interface &B) const {
|
||||
bool operator<(const Interface &A, const Interface &B) {
|
||||
if (A.name() == B.name()) {
|
||||
return (diffSum(A, B) < EqualVersion);
|
||||
} else {
|
||||
return A.name() < B.name();
|
||||
}
|
||||
return A.name() < B.name();
|
||||
}
|
||||
|
||||
bool operator>(const Interface &A, const Interface &B) {
|
||||
if (A.name() == B.name()) {
|
||||
return (diffSum(A, B) > EqualVersion);
|
||||
} else {
|
||||
return A.name() < B.name();
|
||||
}
|
||||
return A.name() < B.name();
|
||||
}
|
||||
|
||||
bool operator<=(const Interface &A, const Interface &B) {
|
||||
if (A.name() == B.name()) {
|
||||
return (diffSum(A, B) <= EqualVersion);
|
||||
} else {
|
||||
return A.name() < B.name();
|
||||
}
|
||||
return A.name() < B.name();
|
||||
}
|
||||
|
||||
bool operator>=(const Interface &A, const Interface &B) {
|
||||
if (A.name() == B.name()) {
|
||||
return (diffSum(A, B) >= EqualVersion);
|
||||
} else {
|
||||
return A.name() < B.name();
|
||||
}
|
||||
return A.name() < B.name();
|
||||
}
|
||||
|
||||
ConfigVar &operator<<(ConfigVar &dst, const Interface &iface) {
|
||||
|
@ -185,13 +185,11 @@ off_t RawFileIO::getSize() const {
|
||||
const_cast<RawFileIO *>(this)->fileSize = stbuf.st_size;
|
||||
const_cast<RawFileIO *>(this)->knownSize = true;
|
||||
return fileSize;
|
||||
} else {
|
||||
RLOG(ERROR) << "getSize on " << name << " failed: " << strerror(errno);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
return fileSize;
|
||||
RLOG(ERROR) << "getSize on " << name << " failed: " << strerror(errno);
|
||||
return -1;
|
||||
}
|
||||
return fileSize;
|
||||
}
|
||||
|
||||
ssize_t RawFileIO::read(const IORequest &req) const {
|
||||
@ -237,14 +235,13 @@ bool RawFileIO::write(const IORequest &req) {
|
||||
<< req.dataLen << ", max retries reached";
|
||||
knownSize = false;
|
||||
return false;
|
||||
} else {
|
||||
if (knownSize) {
|
||||
off_t last = req.offset + req.dataLen;
|
||||
if (last > fileSize) fileSize = last;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
if (knownSize) {
|
||||
off_t last = req.offset + req.dataLen;
|
||||
if (last > fileSize) fileSize = last;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int RawFileIO::truncate(off_t size) {
|
||||
|
@ -368,9 +368,9 @@ CipherKey SSL_Cipher::newKey(const char *password, int passwdLength,
|
||||
if (res <= 0) {
|
||||
RLOG(WARNING) << "openssl error, PBKDF2 failed";
|
||||
return CipherKey();
|
||||
} else {
|
||||
iterationCount = res;
|
||||
}
|
||||
iterationCount = res;
|
||||
|
||||
} else {
|
||||
// known iteration length
|
||||
if (PKCS5_PBKDF2_HMAC_SHA1(
|
||||
@ -510,9 +510,8 @@ bool SSL_Cipher::randomize(unsigned char *buf, int len,
|
||||
}
|
||||
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
uint64_t SSL_Cipher::MAC_64(const unsigned char *data, int len,
|
||||
@ -599,9 +598,8 @@ bool SSL_Cipher::compareKey(const CipherKey &A, const CipherKey &B) const {
|
||||
|
||||
if (memcmp(key1->buffer, key2->buffer, _keySize + _ivLength) != 0) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int SSL_Cipher::encodedKeySize() const {
|
||||
|
@ -146,17 +146,14 @@ class XmlNode : virtual public XmlValue {
|
||||
const char *value = element->Attribute(name + 1);
|
||||
if (value != nullptr) {
|
||||
return std::make_shared<encfs::XmlValue>(value);
|
||||
} else {
|
||||
return XmlValuePtr();
|
||||
}
|
||||
} else {
|
||||
const tinyxml2::XMLElement *el = element->FirstChildElement(name);
|
||||
if (el != nullptr) {
|
||||
return XmlValuePtr(new XmlNode(el));
|
||||
} else {
|
||||
return XmlValuePtr();
|
||||
}
|
||||
return XmlValuePtr();
|
||||
}
|
||||
const tinyxml2::XMLElement *el = element->FirstChildElement(name);
|
||||
if (el != nullptr) {
|
||||
return XmlValuePtr(new XmlNode(el));
|
||||
}
|
||||
return XmlValuePtr();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -57,9 +57,8 @@ autosprintf::operator char *() const {
|
||||
auto *copy = new char[length];
|
||||
memcpy(copy, str, length);
|
||||
return copy;
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
autosprintf::operator std::string() const {
|
||||
return std::string(str != nullptr ? str : "(error in autosprintf)");
|
||||
|
@ -397,10 +397,9 @@ int _do_readlink(EncFS_Context *ctx, const string &cyName, char *buf,
|
||||
buf[size - 1] = '\0';
|
||||
|
||||
return ESUCCESS;
|
||||
} else {
|
||||
RLOG(WARNING) << "Error decoding link";
|
||||
return -1;
|
||||
}
|
||||
RLOG(WARNING) << "Error decoding link";
|
||||
return -1;
|
||||
}
|
||||
|
||||
int encfs_readlink(const char *path, char *buf, size_t size) {
|
||||
@ -655,9 +654,8 @@ int encfs_fsync(const char *path, int dataSync, struct fuse_file_info *file) {
|
||||
int _do_write(FileNode *fnode, unsigned char *ptr, size_t size, off_t offset) {
|
||||
if (fnode->write(offset, ptr, size)) {
|
||||
return size;
|
||||
} else {
|
||||
return -EIO;
|
||||
}
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
int encfs_write(const char *path, const char *buf, size_t size, off_t offset,
|
||||
|
@ -785,15 +785,14 @@ static bool unmountFS(EncFS_Context *ctx) {
|
||||
|
||||
ctx->setRoot(std::shared_ptr<DirNode>());
|
||||
return false;
|
||||
} else {
|
||||
}
|
||||
// Time to unmount!
|
||||
#if FUSE_USE_VERSION < 30
|
||||
fuse_unmount(arg->opts->mountPoint.c_str(), nullptr);
|
||||
fuse_unmount(arg->opts->mountPoint.c_str(), nullptr);
|
||||
#else
|
||||
fuse_unmount(fuse_get_context()->fuse);
|
||||
fuse_unmount(fuse_get_context()->fuse);
|
||||
#endif
|
||||
// fuse_unmount succeeds and returns void
|
||||
RLOG(INFO) << "Filesystem inactive, unmounted: " << arg->opts->mountPoint;
|
||||
return true;
|
||||
}
|
||||
// fuse_unmount succeeds and returns void
|
||||
RLOG(INFO) << "Filesystem inactive, unmounted: " << arg->opts->mountPoint;
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user