提交 1792c42d 编写于 作者: Z zhangdengyu

feat: a核musl升级socket、nscd_query部分

方案描述:
升级socket.c、nscd_query.c至1.2.3

BREAKING CHANGE:
修复测试用例对外变更描述:
1、socket接口v1.2.0中传入错误参数返回EINVAL错误码,更新之后将返回ENOENT错误码;
2、__nscd_query接口v1.2.0中给传入错误参数返回EAFNOSUPPORT错误码,更新之后将返回ENOENT错误码。

Close:#I6WWES
Signed-off-by: Nzhangdengyu <zhangdengyu2@huawei.com>
Change-Id: I877bcca7cae3a98932f2c0f39343f960c555ef76
上级 f3e9facd
...@@ -46,17 +46,17 @@ int socket(int domain, int type, int protocol) ...@@ -46,17 +46,17 @@ int socket(int domain, int type, int protocol)
} }
#endif #endif
int s = socketcall(socket, domain, type, protocol, 0, 0, 0); int s = __socketcall(socket, domain, type, protocol, 0, 0, 0);
if (s<0 && (errno==EINVAL || errno==EPROTONOSUPPORT) if ((s==-EINVAL || s==-EPROTONOSUPPORT)
&& (type&(SOCK_CLOEXEC|SOCK_NONBLOCK))) { && (type&(SOCK_CLOEXEC|SOCK_NONBLOCK))) {
s = socketcall(socket, domain, s = __socketcall(socket, domain,
type & ~(SOCK_CLOEXEC|SOCK_NONBLOCK), type & ~(SOCK_CLOEXEC|SOCK_NONBLOCK),
protocol, 0, 0, 0); protocol, 0, 0, 0);
if (s < 0) return s; if (s < 0) return __syscall_ret(s);
if (type & SOCK_CLOEXEC) if (type & SOCK_CLOEXEC)
__syscall(SYS_fcntl, s, F_SETFD, FD_CLOEXEC); __syscall(SYS_fcntl, s, F_SETFD, FD_CLOEXEC);
if (type & SOCK_NONBLOCK) if (type & SOCK_NONBLOCK)
__syscall(SYS_fcntl, s, F_SETFL, O_NONBLOCK); __syscall(SYS_fcntl, s, F_SETFL, O_NONBLOCK);
} }
return s; return __syscall_ret(s);
} }
...@@ -40,7 +40,15 @@ retry: ...@@ -40,7 +40,15 @@ retry:
buf[0] = NSCDVERSION; buf[0] = NSCDVERSION;
fd = socket(PF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0); fd = socket(PF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
if (fd < 0) return NULL; if (fd < 0) {
if (errno == EAFNOSUPPORT) {
f = fopen("/dev/null", "re");
if (f)
errno = errno_save;
return f;
}
return 0;
}
if(!(f = fdopen(fd, "r"))) { if(!(f = fdopen(fd, "r"))) {
close(fd); close(fd);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册