This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
> There looks to be a logic bug... > > Cyg_ErrNo err; > off_t newpos=pos; > > err = cyg_stdio_lseek( my_device, &newpos, whence ); > > if( err == ENOERR ) > { > // Clean out the buffer. Flush output if any present, > // and clear any input out of input buffer and any ungot > // chars from unread buffer. > > err = flush_output_unlocked(); > io_buf.drain_buffer(); > > It appears to be working out where the new position is and then > seeking the file descriptor to the new position. It then flushed the > stream write buffer and resets the input buffer. > > To me, this seems to be in the wrong order. It should flush the > buffers before moving the file pointer. Attached is a totally untested > patch. It might work. Please give it a try and let me know. > > Andrew I've tested this patch now and it appears to work OK for the simple case i've tested. I've added a new test to the ramfs code which exercises fseek and ftell a little. Andrew
Attachment:
fseek.patch
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |