]> git.sven.stormbind.net Git - sven/fuse-exfat.git/commitdiff
Imported Upstream version 1.0.1 upstream/1.0.1
authorSven Hoexter <sven@stormbind.net>
Tue, 5 Feb 2013 20:12:10 +0000 (21:12 +0100)
committerSven Hoexter <sven@stormbind.net>
Tue, 5 Feb 2013 20:12:10 +0000 (21:12 +0100)
ChangeLog
fuse/main.c
libexfat/io.c
libexfat/node.c
libexfat/version.h

index e24b2d60b651699b3ba001f13752445c4518cfe1..adbf727af2bd2fbaa3ff6123758e842a8d98950e 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 15273473b7ce2ead25f5c972e55b5c2a713b263e..b939164092d2540a09f05ad717d5836986b11a1a 100644 (file)
@@ -155,19 +155,25 @@ static int fuse_exfat_release(const char* path, struct fuse_file_info* fi)
 static int fuse_exfat_read(const char* path, char* buffer, size_t size,
                off_t offset, struct fuse_file_info* fi)
 {
+       ssize_t ret;
+
        exfat_debug("[%s] %s (%zu bytes)", __func__, path, size);
-       if (exfat_generic_pread(&ef, get_node(fi), buffer, size, offset) != size)
-               return EOF;
-       return size;
+       ret = exfat_generic_pread(&ef, get_node(fi), buffer, size, offset);
+       if (ret < 0)
+               return -EIO;
+       return ret;
 }
 
 static int fuse_exfat_write(const char* path, const char* buffer, size_t size,
                off_t offset, struct fuse_file_info* fi)
 {
+       ssize_t ret;
+
        exfat_debug("[%s] %s (%zu bytes)", __func__, path, size);
-       if (exfat_generic_pwrite(&ef, get_node(fi), buffer, size, offset) != size)
-               return EOF;
-       return size;
+       ret = exfat_generic_pwrite(&ef, get_node(fi), buffer, size, offset);
+       if (ret < 0)
+               return -EIO;
+       return ret;
 }
 
 static int fuse_exfat_unlink(const char* path)
index 1a555b969b8df04455afcfebd37122ad8c2d7d6f..4413aaa52ce5b5256a5706a011e652368c0bfc6d 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 cce1de7c0c93eeed5b96887e3f848bf5e369be4a..bc342b780d59292b905ba43a755350bbaf45d82d 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 b795e91592fabdc10d942b502865025f697e48e9..debd1853b991d143ea09f7b3382343278b20f55a 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 */