Skip to content

Fix error handling with getline

Walter Lozano requested to merge wlozano-guest/apt:wip/wlozano/getline-fix into main

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.

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

Merge request reports

Loading