fix
authorMiklos Szeredi <miklos@szeredi.hu>
Wed, 26 Jan 2005 17:07:59 +0000 (17:07 +0000)
committerMiklos Szeredi <miklos@szeredi.hu>
Wed, 26 Jan 2005 17:07:59 +0000 (17:07 +0000)
ChangeLog
kernel/dir.c
kernel/fuse_kernel.h
lib/fuse.c

index 1b20677f7f6ef92315dc3ec27fe2adefd0492354..f7c704e2282c9b7f19fa00a24ecc3e7ecc2ea35b 100644 (file)
--- 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
index f73b5752c9cf924e29fa7cb345b4c6df9d0c6d86..f363a179d8a40c4f718dc815909db56bdcbfe86e 100644 (file)
@@ -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;
index cd8f46f2f7ffa4ec4fc2c042982d4af444ec28ee..870ce5974f42218d79a6748698ab7a952cdf924b 100644 (file)
@@ -133,7 +133,7 @@ struct fuse_rename_in {
 };
 
 struct fuse_link_in {
-       __u64   newdir;
+       __u64   oldnodeid;
 };
 
 struct fuse_setattr_in {
index f80485df3bec4b41e971f4793ba811539f78c6d1..004095c271b8f969d1fa9e9bfd7140d80b005abf 100644 (file)
@@ -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);