termux-packages/disabled-packages/apt-updated/apt-pkg-contrib-srvrec.cc.p...

29 lines
1.0 KiB
Diff
Raw Normal View History

2017-11-07 03:35:03 +01:00
diff -u -r ../apt-1.1.3/apt-pkg/contrib/srvrec.cc ./apt-pkg/contrib/srvrec.cc
--- ../apt-1.1.3/apt-pkg/contrib/srvrec.cc 2015-11-30 03:08:24.000000000 -0500
+++ ./apt-pkg/contrib/srvrec.cc 2015-12-03 16:21:54.397715576 -0500
@@ -40,14 +40,24 @@
struct servent *s_ent = nullptr;
std::vector<char> buf(1024);
+#ifdef __ANDROID__
+ s_ent = getservbyport(htons(port), "tcp");
+ if (s_ent == nullptr) return false;
+#else
res = getservbyport_r(htons(port), "tcp", &s_ent_buf, buf.data(), buf.size(), &s_ent);
if (res != 0 || s_ent == nullptr)
return false;
+#endif
strprintf(target, "_%s._tcp.%s", s_ent->s_name, host.c_str());
return GetSrvRecords(target, Result);
}
+#ifdef __ANDROID__
+extern "C" int __dn_skipname(const unsigned char* comp_dn, const unsigned char* eom);
+static inline int dn_skipname(const unsigned char* a, const unsigned char* b) { return __dn_skipname(a,b); }
+#endif
+
bool GetSrvRecords(std::string name, std::vector<SrvRec> &Result)
{
unsigned char answer[PACKETSZ];