]> git.sven.stormbind.net Git - sven/fuse-exfat.git/blob - debian/patches/fix-unexpected-removal-on-dir-move-r337.patch
New upstream release
[sven/fuse-exfat.git] / debian / patches / fix-unexpected-removal-on-dir-move-r337.patch
1 Fixed unexpected removal of a directory if it is moved into itself: return
2 EINVAL in this situation. It also happens when trying to change directory name
3 case.
4 Picked from upstream svn r337.
5 Index: fuse-exfat/libexfat/node.c
6 ===================================================================
7 --- fuse-exfat.orig/libexfat/node.c     2013-01-25 22:12:09.529117673 +0100
8 +++ fuse-exfat/libexfat/node.c  2013-01-25 22:22:56.473094067 +0100
9 @@ -905,6 +905,23 @@
10                 exfat_put_node(ef, node);
11                 return rc;
12         }
13 +
14 +       /* check that target is not a subdirectory of the source */
15 +       if (node->flags & EXFAT_ATTRIB_DIR)
16 +       {
17 +               struct exfat_node* p;
18 +
19 +               for (p = dir; p; p = p->parent)
20 +                       if (node == p)
21 +                       {
22 +                               if (existing != NULL)
23 +                                       exfat_put_node(ef, existing);
24 +                               exfat_put_node(ef, dir);
25 +                               exfat_put_node(ef, node);
26 +                               return -EINVAL;
27 +                       }
28 +       }
29 +
30         if (existing != NULL)
31         {
32                 /* remove target if it's not the same node as source */