Am 10.11.22 um 09:33 schrieb Remi Gacogne:
On 10/11/2022 03:58, Allan McRae wrote:
In fact, that whole while loop looks weird to me. Do we need one here? It looks like if the read() call fails, we bail. Then only bail if we processed that call correctly? Weird...
I believe we need the loop because we might have to process more than one callback event. We want to exit the loop as soon as either the read() call failed, or processing one of the even failed (_alpm_sandbox_process_cb_log or _alpm_sandbox_process_cb_download returning false), so we could get rid of the "done" variable by always breaking indeed, since when we do break it is useless to set "done = true".
Remi
yeah, the loop should be needed for processing multiple events, that's my understanding, too. Progress events would turn up every time there's a progress update, for example, wouldn't they?
On 10/11/2022 03:58, Allan McRae wrote: Then only bail if we processed that call correctly?
I think you (Allan) overlooked that those processing functions return boolean true for success, false for error, instead of the (usual?) int == 0 for success and int != 0 for error. -- regards, bp