mirror of
https://github.com/devkitPro/wut.git
synced 2026-08-28 13:55:04 -05:00
wutdevoptab: Only update the file->offset on a successful seek.
This commit is contained in:
@@ -56,11 +56,14 @@ __wut_fs_seek(struct _reent *r,
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Update the current offset
|
||||
uint32_t old_offset = file->offset;
|
||||
file->offset = offset + pos;
|
||||
|
||||
status = FSSetPosFile(__wut_devoptab_fs_client, &cmd, file->fd, file->offset,
|
||||
FS_ERROR_FLAG_ALL);
|
||||
if (status < 0) {
|
||||
// revert offset update on error.
|
||||
file->offset = old_offset;
|
||||
r->_errno = __wut_fs_translate_error(status);
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user