Skip to content

Fix DI return code checks#16

Open
Leseratte10 wants to merge 1 commit intoChadderz121:masterfrom
Leseratte10:patch-di
Open

Fix DI return code checks#16
Leseratte10 wants to merge 1 commit intoChadderz121:masterfrom
Leseratte10:patch-di

Conversation

@Leseratte10
Copy link
Contributor

The old code retried DI_Read calls until the return value was not negative. However, that never happens. DI_Read and most other DI functions have 1 as the success case, and positive numbers larger than 1 for errors. This means that without this PR, reads could sometimes fail (due to disc issues or whatever), and instead of noticing and retrying, Brainslug would just assume that the data was read correctly.

@Leseratte10
Copy link
Contributor Author

Addition: That also means that the di_has_partition variable in di.c is probably invalid / wrong, as it also doesn't correctly check the return code. That's not yet fixed with this PR, though.

@suprstarrd
Copy link

suprstarrd commented May 27, 2021

If you're still actively working on this PR...

while ((ret = DI_DiscInserted()) != 1) {
if (ret < 0) {
continue;
}

Is this meant to still be ret < 0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants