未验证 提交 d6f74fda 编写于 作者: O openharmony_ci 提交者: Gitee

!985 Optimize fileno_unlocked

Merge pull request !985 from 李涛/fileno_unlocked
......@@ -2223,6 +2223,7 @@ musl_src_porting_file = [
"src/misc/aarch64/syscall.s",
"src/stdlib/strtod.c",
"src/stdio/vfscanf.c",
"src/stdio/fileno.c",
]
musl_inc_hook_files = [
......
#include "stdio_impl.h"
#include <errno.h>
int fileno_unlocked(FILE *f)
{
int fd = f->fd;
if (fd < 0) {
errno = EBADF;
return -1;
}
return fd;
}
int fileno(FILE *f)
{
FLOCK(f);
int fd = fileno_unlocked(f);
FUNLOCK(f);
return fd;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册