The getln() function behaves inconsistently w.r.t. closing the file descriptor on error - sometimes it does that, sometimes it doesn't. As the result, if getln() returns an error, the caller has no idea whether the file descriptor has been closed or not.
In general, closing the file descriptor is quite surprising behavior for such a function. If it is desirable for whatever reason, it would be nice to mention it in the comment describing the function.
The getln() function behaves inconsistently w.r.t. closing the file descriptor on error - sometimes it does that, sometimes it doesn't. As the result, if getln() returns an error, the caller has no idea whether the file descriptor has been closed or not.
In general, closing the file descriptor is quite surprising behavior for such a function. If it is desirable for whatever reason, it would be nice to mention it in the comment describing the function.