projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
all printf variants: fix argument type handling for %c and %lc
[musl]
/
src
/
stdio
/
fileno.c
diff --git
a/src/stdio/fileno.c
b/src/stdio/fileno.c
index
9ffb26d
..
0bd0e98
100644
(file)
--- a/
src/stdio/fileno.c
+++ b/
src/stdio/fileno.c
@@
-1,8
+1,16
@@
#include "stdio_impl.h"
+#include <errno.h>
int fileno(FILE *f)
{
- return f->fd;
+ FLOCK(f);
+ int fd = f->fd;
+ FUNLOCK(f);
+ if (fd < 0) {
+ errno = EBADF;
+ return -1;
+ }
+ return fd;
}
weak_alias(fileno, fileno_unlocked);