mirror of
https://gitlab.freedesktop.org/libbsd/libbsd.git
synced 2025-01-24 02:51:43 +01:00
fgetln: Fix function to make it actually work
Reported by Thorsten Glaser.
This commit is contained in:
parent
da92787d48
commit
47109e39d5
@ -35,13 +35,11 @@ char *
|
||||
fgetln (FILE *stream, size_t *len)
|
||||
{
|
||||
char *line=NULL;
|
||||
size_t nread = 0;
|
||||
ssize_t nread;
|
||||
|
||||
while (nread == 1) {
|
||||
nread = getline (&line, len, stream);
|
||||
if (nread == -1)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
(*len)--; /* get rid of the trailing \0, fgetln
|
||||
does not have it */
|
||||
|
Loading…
x
Reference in New Issue
Block a user