From db623272df5d8b964f93e13a45c7363c0fc0b48f Mon Sep 17 00:00:00 2001 From: Ben RUBSON Date: Thu, 15 Mar 2018 19:55:59 +0100 Subject: [PATCH] Revert from/to link parameters for readability --- encfs/DirNode.cpp | 8 ++++---- encfs/DirNode.h | 2 +- encfs/encfs.cpp | 4 ++-- encfs/encfs.h | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/encfs/DirNode.cpp b/encfs/DirNode.cpp index ecbdf43..009c8f8 100644 --- a/encfs/DirNode.cpp +++ b/encfs/DirNode.cpp @@ -609,14 +609,14 @@ int DirNode::rename(const char *fromPlaintext, const char *toPlaintext) { return res; } -int DirNode::link(const char *from, const char *to) { +int DirNode::link(const char *to, const char *from) { Lock _lock(mutex); - string fromCName = rootDir + naming->encodePath(from); string toCName = rootDir + naming->encodePath(to); + string fromCName = rootDir + naming->encodePath(from); - rAssert(!fromCName.empty()); rAssert(!toCName.empty()); + rAssert(!fromCName.empty()); VLOG(1) << "link " << fromCName << " -> " << toCName; @@ -624,7 +624,7 @@ int DirNode::link(const char *from, const char *to) { if (fsConfig->config->externalIVChaining) { VLOG(1) << "hard links not supported with external IV chaining!"; } else { - res = ::link(fromCName.c_str(), toCName.c_str()); + res = ::link(toCName.c_str(), fromCName.c_str()); if (res == -1) { res = -errno; } else { diff --git a/encfs/DirNode.h b/encfs/DirNode.h index f2cdf50..f8f6609 100644 --- a/encfs/DirNode.h +++ b/encfs/DirNode.h @@ -130,7 +130,7 @@ class DirNode { int rename(const char *fromPlaintext, const char *toPlaintext); - int link(const char *from, const char *to); + int link(const char *to, const char *from); // returns idle time of filesystem in seconds int idleSeconds(); diff --git a/encfs/encfs.cpp b/encfs/encfs.cpp index 27c6160..ccbc752 100644 --- a/encfs/encfs.cpp +++ b/encfs/encfs.cpp @@ -500,7 +500,7 @@ int encfs_symlink(const char *to, const char *from) { return res; } -int encfs_link(const char *from, const char *to) { +int encfs_link(const char *to, const char *from) { EncFS_Context *ctx = context(); if (isReadOnly(ctx)) { @@ -514,7 +514,7 @@ int encfs_link(const char *from, const char *to) { } try { - res = FSRoot->link(from, to); + res = FSRoot->link(to, from); } catch (encfs::Error &err) { RLOG(ERROR) << "error caught in link: " << err.what(); } diff --git a/encfs/encfs.h b/encfs/encfs.h index 31e03d0..d0fd5f7 100644 --- a/encfs/encfs.h +++ b/encfs/encfs.h @@ -70,7 +70,7 @@ int encfs_unlink(const char *path); int encfs_rmdir(const char *path); int encfs_symlink(const char *from, const char *to); int encfs_rename(const char *from, const char *to); -int encfs_link(const char *from, const char *to); +int encfs_link(const char *to, const char *from); int encfs_chmod(const char *path, mode_t mode); int encfs_chown(const char *path, uid_t uid, gid_t gid); int encfs_truncate(const char *path, off_t size);