Commit Graph

18 Commits

Author SHA1 Message Date
Guillem Jover
6eebc1f264 Fix typo in fgetln() linker warning 2018-05-21 04:48:32 +02:00
Guillem Jover
0982dcd98b Lock the file streams in fgetln() and fparseln()
The fparseln() function had the NetBSD uppercase macros stubbed out,
so replace them with the actual stdio ones. The fgetln() function was
missing any locking at all.
2015-09-23 07:59:34 +02:00
Guillem Jover
151bc71d64 Add compile and link-time deprecation warnings for fgetln()
Although the current implementation in libbsd is probably one of the
safest ones around, it still poses some problems when used with many
file streams. This function has now a replacement, that is both more
standard and portable. Ask users to switch to getline(3) instead.
2015-09-23 07:59:34 +02:00
Guillem Jover
cb7bc0d85e Add file buffer pool support to fgetln()
This avoids buffer overwrites during concurrent or intermixed calls to
fgetln() when using more than one different stream (currently 32), which
the original interface supports natively by using an internal buffer
from the FILE structure. Although this workaround is rudimentary, it
should cover most of the theoretically problematic cases.
2013-05-27 02:12:51 +02:00
Guillem Jover
e7f3976088 Add email address to my name 2012-05-29 04:51:45 +02:00
Guillem Jover
f8e8063079 Base fgetln() implementation on getline presence instead of glibc 2012-05-29 04:51:04 +02:00
Guillem Jover
b891772ad6 Remove blank lines at EOF 2011-05-29 02:49:37 +02:00
Guillem Jover
94fe901eda Abort compilation if fgetln cannot be wrapped 2011-05-16 13:23:18 +02:00
Guillem Jover
abe0a4a7e6 Reformat code to KNF 2010-01-10 15:29:51 +01:00
Thorsten Glaser
c17c7e13c3 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>
2009-12-10 21:07:02 +01:00
Guillem Jover
1f0b016e97 Use UTF-8 copyright symbols for non-imported files 2009-05-20 04:20:21 +02:00
Guillem Jover
74ae34e792 Fix buffer leaks in fgetln
Cache the size and the buffer allocated by getline as static variables.
2009-05-15 21:26:09 +02:00
Guillem Jover
deb9f56ceb Change fgetln to return the correct length value
Set len to 0 on error conditions to mimmic FreeBSD behaviour, and return
the amount of read characters on success, instead of the allocated size
by getline.

Reported-by: Jief L. <jief1.l@gmail.com>
2009-05-15 21:23:03 +02:00
Guillem Jover
fafffd1f7e fgetln: Fix coding style 2008-07-09 08:26:07 +03:00
Guillem Jover
47109e39d5 fgetln: Fix function to make it actually work
Reported by Thorsten Glaser.
2008-07-09 08:22:30 +03:00
Guillem Jover
da92787d48 Ansify function arguments 2008-07-09 07:46:23 +03:00
Guillem Jover
d699e4bc0e Add license header
With Hector's agreement.
2008-06-18 08:05:54 +03:00
Guillem Jover
5372b73685 Move sources to src/ 2008-05-06 08:50:42 +03:00