Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Nov 2024 19:27:12 +0000
From:      bugzilla-noreply@freebsd.org
To:        standards@FreeBSD.org
Subject:   [Bug 283014] POSIX issue 7: fileno should be able to fail with EBADF
Message-ID:  <bug-283014-99-eHKhaqj5JP@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-283014-99@https.bugs.freebsd.org/bugzilla/>
References:  <bug-283014-99@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D283014

Ed Maste <emaste@freebsd.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |emaste@freebsd.org

--- Comment #1 from Ed Maste <emaste@freebsd.org> ---
Perhaps:

diff --git a/lib/libc/stdio/fileno.c b/lib/libc/stdio/fileno.c
index 66502430dc3d..ff317993c0d3 100644
--- a/lib/libc/stdio/fileno.c
+++ b/lib/libc/stdio/fileno.c
@@ -49,6 +49,9 @@ fileno(FILE *fp)
        fd =3D __sfileno(fp);
        FUNLOCKFILE(fp);

+       if (fd =3D=3D -1)
+               errno =3D EBADF;
+
        return (fd);
 }

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-283014-99-eHKhaqj5JP>