mirror of
https://gitlab.freedesktop.org/libbsd/libbsd.git
synced 2025-01-24 02:51:43 +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
|
int
|
||||||
fpurge(FILE *fp)
|
fpurge(FILE *fp)
|
||||||
{
|
{
|
||||||
if (fp == NULL || fileno(fp) < 0) {
|
if (fp == NULL) {
|
||||||
errno = EBADF;
|
errno = EBADF;
|
||||||
return EOF;
|
return EOF;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user