提交 6a209f14 编写于 作者: R Rich Felker

fix possible fd leak, unrestored cancellation state on dns socket fail

上级 500f5bee
......@@ -76,7 +76,11 @@ int __res_msend_rc(int nqueries, const unsigned char *const *queries,
fd = socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
family = AF_INET;
}
if (fd < 0 || bind(fd, (void *)&sa, sl) < 0) return -1;
if (fd < 0 || bind(fd, (void *)&sa, sl) < 0) {
if (fd >= 0) close(fd);
pthread_setcancelstate(cs, 0);
return -1;
}
/* Past this point, there are no errors. Each individual query will
* yield either no reply (indicated by zero length) or an answer
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册