mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-19 09:32:27 +02:00
@@ -1479,6 +1479,17 @@ read_again:
|
|||||||
*/
|
*/
|
||||||
if ((size_t)rv > (len - rc) /* Prevent overflow */
|
if ((size_t)rv > (len - rc) /* Prevent overflow */
|
||||||
|| rv == 0) { /* Prevent infinite 0-byte loop */
|
|| rv == 0) { /* Prevent infinite 0-byte loop */
|
||||||
|
/*
|
||||||
|
* TODO: handle rv == 0 this way:
|
||||||
|
* re-try a finite number of times,
|
||||||
|
* based on a counter, that resets
|
||||||
|
* on a non-zero read but then returns
|
||||||
|
* like below if the counter reaches
|
||||||
|
* the limit. This will retain the
|
||||||
|
* current safety, while increasing
|
||||||
|
* robustness e.g. on unreliable NFS
|
||||||
|
* shares or really slow media.
|
||||||
|
*/
|
||||||
errno = EIO;
|
errno = EIO;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user