yaffs direct: Fix yaffs direct offset handling for pwrite
authorCharles Manning <cdhmanning@gmail.com>
Thu, 24 Jun 2010 21:45:43 +0000 (09:45 +1200)
committerCharles Manning <cdhmanning@gmail.com>
Thu, 24 Jun 2010 21:45:43 +0000 (09:45 +1200)
Note that if the handle is opened with O_APPEND then the pwrite() offset
is ignored and the write appends.

Signed-off-by: Charles Manning <cdhmanning@gmail.com>
direct/yaffsfs.c

index 9f6008d..2b64bc6 100644 (file)
@@ -826,10 +826,10 @@ int yaffsfs_do_write(int fd, const void *vbuf, unsigned int nbyte, int isPwrite,
                yaffsfs_SetError(-EINVAL);
                totalWritten=-1;
        } else if( h && obj){
-               if(isPwrite)
-                       startPos = offset;
                if(h->append)
                        startPos = yaffs_GetObjectFileLength(obj);
+               else if(isPwrite)
+                       startPos = offset;
                else
                        startPos = h->position;