mirror of
https://gitlab.freedesktop.org/libbsd/libbsd.git
synced 2025-01-08 11:02:24 +01:00
fpurge: Make it work with non fd based FILEs
Streams opened with for example open_memstream(3) will have no associated file descriptor, and fileno(3) will fail. Signed-off-by: Guillem Jover <guillem@hadrons.org>
This commit is contained in:
parent
091097e062
commit
ba3c46b30f
@ -32,7 +32,7 @@
|
||||
int
|
||||
fpurge(FILE *fp)
|
||||
{
|
||||
if (fp == NULL || fileno(fp) < 0) {
|
||||
if (fp == NULL) {
|
||||
errno = EBADF;
|
||||
return EOF;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user