Skip to content

Fix error handling with getline

Walter Lozano requested to merge wip/wlozano/getline-fix into apertis/v2023pre

The function getline is used to read data from different streams, however, the error handling is not accurate.

From the man page, getline returns -1 on failure and sets errno accordingly, but the current implementation only checks errno to see if there was a failure. With this approach, in case getline returns success but also sets errno it is consider and error.

Fix the issue but also checking the return value of getline.

Forwarded: https://salsa.debian.org/apt-team/apt/-/merge_requests/265

https://phabricator.apertis.org/T9316

Signed-off-by: Walter Lozano walter.lozano@collabora.com

Edited by Walter Lozano

Merge request reports