From a74a95ae5b5a6e063356838136067e049b30acc1 Mon Sep 17 00:00:00 2001 From: Sven Hoexter Date: Fri, 25 Jan 2013 22:17:55 +0100 Subject: [PATCH] Add debian/patches/fix-unexpected-removal-on-dir-move-r337.patch Fixes unexpected removal of a directory if you move it into itself. --- debian/changelog | 2 ++ ...-unexpected-removal-on-dir-move-r337.patch | 32 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 debian/patches/fix-unexpected-removal-on-dir-move-r337.patch diff --git a/debian/changelog b/debian/changelog index 09027d9..817b6eb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,8 @@ fuse-exfat (1.0.0-2) UNRELEASED; urgency=low * Build depend on quilt, use dh --with quilt. * Add debian/patches/fix-fuse-read-write-return-r336.patch Fixes "Operation not permitted" error reporting on empty files. + * Add debian/patches/fix-unexpected-removal-on-dir-move-r337.patch + Fixes unexpected removal of a directory if you move it into itself. -- Sven Hoexter Fri, 25 Jan 2013 21:53:16 +0100 diff --git a/debian/patches/fix-unexpected-removal-on-dir-move-r337.patch b/debian/patches/fix-unexpected-removal-on-dir-move-r337.patch new file mode 100644 index 0000000..376fb82 --- /dev/null +++ b/debian/patches/fix-unexpected-removal-on-dir-move-r337.patch @@ -0,0 +1,32 @@ +Fixed unexpected removal of a directory if it is moved into itself: return +EINVAL in this situation. It also happens when trying to change directory name +case. +Picked from upstream svn r337. +Index: libexfat/node.c +=================================================================== +--- libexfat/node.c.orig 2013-01-25 22:09:06.197124362 +0100 ++++ libexfat/node.c 2013-01-25 22:11:41.273118704 +0100 +@@ -905,6 +905,23 @@ + exfat_put_node(ef, node); + return rc; + } ++ ++ /* check that target is not a subdirectory of the source */ ++ if (node->flags & EXFAT_ATTRIB_DIR) ++ { ++ struct exfat_node* p; ++ ++ for (p = dir; p; p = p->parent) ++ if (node == p) ++ { ++ if (existing != NULL) ++ exfat_put_node(ef, existing); ++ exfat_put_node(ef, dir); ++ exfat_put_node(ef, node); ++ return -EINVAL; ++ } ++ } ++ + if (existing != NULL) + { + /* remove target if it's not the same node as source */ -- 2.39.5