devoptab: Make sure file->offset gets updated and initialized

This commit is contained in:
GaryOderNichts 2022-07-29 23:40:19 +02:00 committed by fincs
parent b86ac2bf98
commit 2c299d71fc
3 changed files with 3 additions and 0 deletions

View File

@ -59,6 +59,7 @@ __wut_fs_open(struct _reent *r,
file = (__wut_fs_file_t *)fileStruct;
file->fd = fd;
file->flags = (flags & (O_ACCMODE|O_APPEND|O_SYNC));
file->offset = 0;
if (flags & O_APPEND) {
status = FSGetPosFile(__wut_devoptab_fs_client, &cmd, fd, &file->offset, FS_ERROR_FLAG_ALL);
if (status < 0) {

View File

@ -56,6 +56,7 @@ ssize_t __wut_fs_read(struct _reent *r, void *fd, char *ptr, size_t len) {
memcpy(ptr, alignedBuffer, status);
}
file->offset += status;
bytesRead += status;
ptr += status;

View File

@ -53,6 +53,7 @@ ssize_t __wut_fs_write(struct _reent *r, void *fd, const char *ptr, size_t len)
return -1;
}
file->offset += status;
bytesWritten += status;
ptr += status;