Dear Charles,

 

I think I’ve found a bug in yaffsfs.c in function yaffsfs_do_write(int fd, const void *vbuf, unsigned int nbyte, int isPwrite, int offset)

In this function there is the following section –

 

            if(!h || !obj){

                        // bad handle

                        yaffsfs_SetError(-EBADF);

                        totalWritten = -1;

            } else if( h && obj && (h->readOnly || obj->myDev->readOnly)){

                        yaffsfs_SetError(-EINVAL);

                        totalWritten=-1;

            } else if( h && obj){

                        if(isPwrite)

                                    startPos = offset;

                        else if(h->append)

                                    startPos = yaffs_GetObjectFileLength(obj);

                        else

                                    startPos = h->position;

 

 

The bolded “else” is missing and should be added.

Otherwise, if you call this function with “isPwrite = 1”, startPos will not get your desired “offset”, because it will be overwritten.

 

Thanks

 

-------------------------------------------------------------------------
Amir Comforti

Zoran Microelectronics Ltd
Phone:  +972 4 8546310

Email:   amir.comforti@zoran.com

Web:   
www.zoran.com
-------------------------------------------------------------------------