Imported Upstream version 1.0.1 upstream/1.0.1
authorSven Hoexter <sven@stormbind.net>
Tue, 5 Feb 2013 20:11:50 +0000 (21:11 +0100)
committerSven Hoexter <sven@stormbind.net>
Tue, 5 Feb 2013 20:11:50 +0000 (21:11 +0100)
ChangeLog
libexfat/io.c
libexfat/node.c
libexfat/version.h

index e24b2d6..adbf727 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+1.0.1 (2013-02-02)
+
+* Fixed unexpected removal of a directory if it is moved into itself.
+* Fixed "Operation not permitted" error on reading an empty file.
+
 1.0.0 (2013-01-19)
 
 * Fixed crash when renaming a file within a single directory and a new name
index 1a555b9..4413aaa 100644 (file)
@@ -341,7 +341,7 @@ ssize_t exfat_generic_pread(const struct exfat* ef, struct exfat_node* node,
        }
        if (!ef->ro && !ef->noatime)
                exfat_update_atime(node);
-       return size - remainder;
+       return MIN(size, node->size - offset) - remainder;
 }
 
 ssize_t exfat_generic_pwrite(struct exfat* ef, struct exfat_node* node,
index cce1de7..bc342b7 100644 (file)
@@ -905,6 +905,23 @@ int exfat_rename(struct exfat* ef, const char* old_path, const char* new_path)
                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 */
index b795e91..debd185 100644 (file)
@@ -23,6 +23,6 @@
 
 #define EXFAT_VERSION_MAJOR 1
 #define EXFAT_VERSION_MINOR 0
-#define EXFAT_VERSION_PATCH 0
+#define EXFAT_VERSION_PATCH 1
 
 #endif /* ifndef VERSION_H_INCLUDED */