mirror of
https://gitlab.freedesktop.org/libbsd/libbsd.git
synced 2025-10-24 00:49:49 +02:00
Expand on API guarantee for fgetln
OpenBSD has begun using the API guarantee that *len is not 0 if the fgetln(3) return value is not NULL; document this explicitly in the manpage and add a comment to the function implementation that this doesn’t need to be checked because getdelim/getline have similar guarantees. Signed-off-by: Thorsten Glaser <tg@mirbsd.org>
This commit is contained in:

committed by
Guillem Jover

parent
a5dbef45e7
commit
c17c7e13c3
@@ -39,6 +39,7 @@ fgetln (FILE *stream, size_t *len)
|
||||
ssize_t nread;
|
||||
|
||||
nread = getline(&line, &line_len, stream);
|
||||
/* Note: the getdelim/getline API ensures nread != 0. */
|
||||
if (nread == -1) {
|
||||
*len = 0;
|
||||
return NULL;
|
||||
|
Reference in New Issue
Block a user