aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--kernel/dir.c4
-rw-r--r--kernel/fuse_kernel.h2
-rw-r--r--lib/fuse.c6
4 files changed, 11 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 1b20677..f7c704e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-01-26 Miklos Szeredi <miklos@szeredi.hu>
+
+ * Fix bug in link() operation which caused the wrong path to be
+ passed as the first argument. Found by Anton Altaparmakov
+
2005-01-21 Miklos Szeredi <miklos@szeredi.hu>
* LIB: fix double reply in readdir operation
diff --git a/kernel/dir.c b/kernel/dir.c
index f73b575..f363a17 100644
--- a/kernel/dir.c
+++ b/kernel/dir.c
@@ -376,9 +376,9 @@ static int fuse_link(struct dentry *entry, struct inode *newdir,
return -ERESTARTNOINTR;
memset(&inarg, 0, sizeof(inarg));
- inarg.newdir = get_node_id(newdir);
+ inarg.oldnodeid = get_node_id(inode);
req->in.h.opcode = FUSE_LINK;
- req->inode2 = newdir;
+ req->inode2 = inode;
req->in.numargs = 2;
req->in.args[0].size = sizeof(inarg);
req->in.args[0].value = &inarg;
diff --git a/kernel/fuse_kernel.h b/kernel/fuse_kernel.h
index cd8f46f..870ce59 100644
--- a/kernel/fuse_kernel.h
+++ b/kernel/fuse_kernel.h
@@ -133,7 +133,7 @@ struct fuse_rename_in {
};
struct fuse_link_in {
- __u64 newdir;
+ __u64 oldnodeid;
};
struct fuse_setattr_in {
diff --git a/lib/fuse.c b/lib/fuse.c
index f80485d..004095c 100644
--- a/lib/fuse.c
+++ b/lib/fuse.c
@@ -1044,9 +1044,9 @@ static void do_link(struct fuse *f, struct fuse_in_header *in,
struct fuse_entry_out outarg;
res = -ENOENT;
- oldpath = get_path(f, in->nodeid);
+ oldpath = get_path(f, arg->oldnodeid);
if (oldpath != NULL) {
- newpath = get_path_name(f, arg->newdir, name);
+ newpath = get_path_name(f, in->nodeid, name);
if (newpath != NULL) {
if (f->flags & FUSE_DEBUG) {
printf("LINK %s\n", newpath);
@@ -1056,7 +1056,7 @@ static void do_link(struct fuse *f, struct fuse_in_header *in,
if (f->op.link && f->op.getattr) {
res = f->op.link(oldpath, newpath);
if (res == 0)
- res = lookup_path(f, arg->newdir, in->unique, name,
+ res = lookup_path(f, in->nodeid, in->unique, name,
newpath, &outarg);
}
free(newpath);