[Bug 283014] POSIX issue 7: fileno should be able to fail with EBADF
| Newsgroups | gmane.os.freebsd.devel.standards |
|---|---|
| Message-ID | <[email protected]/bugzilla/> |
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=283014 Ed Maste <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #1 from Ed Maste <[email protected]> --- 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 = __sfileno(fp); FUNLOCKFILE(fp); + if (fd == -1) + errno = EBADF; + return (fd); } -- You are receiving this mail because: You are the assignee for the bug.