FujiNetWIFI / FujiNetWIFI/fujinet-lib

network_read_nb discards the SIO read status

Open Beginner friendly
#77 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
9
Forks
22
PR merge metrics
No merged PRs in 30d

Description

### Summary

`common/src/fn_network/network_read_nb.c`:

```c
#if defined(__ATARI__)
sio_read(unit, buf, fetch_size);
#endif
...
fn_bytes_read = fetch_size;
...
return fetch_size;
```

`sio_read()` returns the device status, but it is ignored: after a
failed SIO read the function still reports `fetch_size` bytes
"successfully" read. The buffer then contains garbage/stale data and a
polling client can loop forever, because bytes-waiting never decreases
while every read keeps "succeeding". Observed on hardware as an
endless stream of `'R' ... ERROR!` lines in the USB log while the
client believed it was making progress. The error should propagate as
a negative return like the other error paths in this function.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in common/src/fn_network/network_read_nb.c at the __ATARI__ sio_read() call, then compare the surrounding error paths in this function. Confirm how the SIO status should be propagated and verify that a failed read no longer reports fetch_size bytes or updates the byte count as a successful read.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
networking
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.