Fix -ENOSPC to work properly with zero length writes
[yaffs2.git] / yaffs_fs.c
index 5c368087f90f33398127e231c0c70da6a338c4ce..ed247f9e9307a5afbf58e68853519987b4cdd434 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
  *
- * Copyright (C) 2002-2007 Aleph One Ltd.
+ * Copyright (C) 2002-2009 Aleph One Ltd.
  *   for Toby Churchill Ltd and Brightstar Engineering
  *
  * Created by Charles Manning <charles@aleph1.co.uk>
@@ -32,7 +32,7 @@
  */
 
 const char *yaffs_fs_c_version =
-    "$Id: yaffs_fs.c,v 1.78 2009-03-09 13:08:09 wookey Exp $";
+    "$Id: yaffs_fs.c,v 1.80 2009-05-12 02:23:51 charles Exp $";
 extern const char *yaffs_guts_c_version;
 
 #include <linux/version.h>
@@ -1075,7 +1075,7 @@ static ssize_t yaffs_file_write(struct file *f, const char *buf, size_t n,
 
        }
        yaffs_GrossUnlock(dev);
-       return nWritten == 0 ? -ENOSPC : nWritten;
+       return (nWritten == 0) && (n > 0) ? -ENOSPC : nWritten;
 }
 
 /* Space holding and freeing is done to ensure we have space available for write_begin/end */