mirror of
https://github.com/vgough/encfs.git
synced 2025-06-24 14:02:13 +02:00
encfs_symlink: Fix argument naming (was reversed)
It is symlink(target, link_name), see man 3 symlink
This commit is contained in:
parent
32102447e0
commit
52f189b232
@ -361,7 +361,10 @@ int encfs_readlink(const char *path, char *buf, size_t size) {
|
|||||||
bind(_do_readlink, _1, _2, buf, size));
|
bind(_do_readlink, _1, _2, buf, size));
|
||||||
}
|
}
|
||||||
|
|
||||||
int encfs_symlink(const char *from, const char *to) {
|
/**
|
||||||
|
* Create a symbolic link pointing to "to" named "from"
|
||||||
|
*/
|
||||||
|
int encfs_symlink(const char *to, const char *from) {
|
||||||
EncFS_Context *ctx = context();
|
EncFS_Context *ctx = context();
|
||||||
|
|
||||||
if (isReadOnly(ctx)) return -EROFS;
|
if (isReadOnly(ctx)) return -EROFS;
|
||||||
@ -372,8 +375,8 @@ int encfs_symlink(const char *from, const char *to) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// allow fully qualified names in symbolic links.
|
// allow fully qualified names in symbolic links.
|
||||||
string fromCName = FSRoot->relativeCipherPath(from);
|
string fromCName = FSRoot->cipherPath(from);
|
||||||
string toCName = FSRoot->cipherPath(to);
|
string toCName = FSRoot->relativeCipherPath(to);
|
||||||
|
|
||||||
rLog(Info, "symlink %s -> %s", fromCName.c_str(), toCName.c_str());
|
rLog(Info, "symlink %s -> %s", fromCName.c_str(), toCName.c_str());
|
||||||
|
|
||||||
@ -386,7 +389,7 @@ int encfs_symlink(const char *from, const char *to) {
|
|||||||
olduid = setfsuid(context->uid);
|
olduid = setfsuid(context->uid);
|
||||||
oldgid = setfsgid(context->gid);
|
oldgid = setfsgid(context->gid);
|
||||||
}
|
}
|
||||||
res = ::symlink(fromCName.c_str(), toCName.c_str());
|
res = ::symlink(toCName.c_str(), fromCName.c_str());
|
||||||
if (olduid >= 0) setfsuid(olduid);
|
if (olduid >= 0) setfsuid(olduid);
|
||||||
if (oldgid >= 0) setfsgid(oldgid);
|
if (oldgid >= 0) setfsgid(oldgid);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user