mirror of
https://github.com/devkitPro/wut.git
synced 2026-03-21 17:34:47 -05:00
devoptab: Make sure file->offset gets updated and initialized
This commit is contained in:
parent
b86ac2bf98
commit
2c299d71fc
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user